diff options
author | sb <sb@openoffice.org> | 2010-03-10 16:47:22 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-03-10 16:47:22 +0100 |
commit | 2bd7376e52a2aa6da11962a4ff9495dec0c139db (patch) | |
tree | d27050da8508adaaaf940a30fd77751d86ec52fc /ucb | |
parent | 048f03264ce58c927c63460de84e5a87699998ba (diff) | |
parent | 8d8c715352d37c28e0e4987a29dbdb3e3db50ac8 (diff) |
tkr33: merged in DEV300_m74
Diffstat (limited to 'ucb')
299 files changed, 4350 insertions, 3674 deletions
diff --git a/ucb/inc/makefile.mk b/ucb/inc/makefile.mk index c98dc5fe07e2..1ed22bada671 100644 --- a/ucb/inc/makefile.mk +++ b/ucb/inc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/inc/pch/precompiled_ucb.cxx b/ucb/inc/pch/precompiled_ucb.cxx index ba6d56a660d5..31acd44cd3f8 100644 --- a/ucb/inc/pch/precompiled_ucb.cxx +++ b/ucb/inc/pch/precompiled_ucb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_ucb.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/inc/pch/precompiled_ucb.hxx b/ucb/inc/pch/precompiled_ucb.hxx index ec3ba9b1ef52..e272c541e4c0 100644 --- a/ucb/inc/pch/precompiled_ucb.hxx +++ b/ucb/inc/pch/precompiled_ucb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: precompiled_ucb.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/CheckContentProvider.java b/ucb/qa/complex/tdoc/CheckContentProvider.java index c2725593a782..a20a96829e0b 100755 --- a/ucb/qa/complex/tdoc/CheckContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckContentProvider.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: CheckContentProvider.java,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java index 41aa92ab09b2..b492fd219119 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContent.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: CheckTransientDocumentsContent.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java index 161f8db64bd2..ddac0cbb2d47 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsContentProvider.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: CheckTransientDocumentsContentProvider.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java index fc8cf81c4aaf..229f5d388697 100755 --- a/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java +++ b/ucb/qa/complex/tdoc/CheckTransientDocumentsDocumentContent.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: CheckTransientDocumentsDocumentContent.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,7 +46,6 @@ import com.sun.star.ucb.OpenMode; import com.sun.star.ucb.XCommandProcessor; import com.sun.star.ucb.XContent; import com.sun.star.ucb.XContentAccess; -import com.sun.star.ucb.XContentCreator; import com.sun.star.ucb.XContentIdentifier; import com.sun.star.ucb.XContentIdentifierFactory; import com.sun.star.ucb.XContentProvider; @@ -139,12 +135,16 @@ public class CheckTransientDocumentsDocumentContent extends ComplexTestCase { } } // create a folder - XContent xNewFolder = null; log.println("Create new folder "+ folderName); ContentInfo contentInfo = new ContentInfo(); contentInfo.Type = "application/vnd.sun.star.tdoc-folder"; - XContentCreator xContentCreator = (XContentCreator)UnoRuntime.queryInterface(XContentCreator.class, xContent); - xNewFolder = xContentCreator.createNewContent(contentInfo); + + command.Name = "createNewContent"; + command.Argument = contentInfo; + + result = xCommandProcessor.execute(command, 0, null); + XContent xNewFolder = (XContent)UnoRuntime.queryInterface(XContent.class, result); + XCommandProcessor xFolderCommandProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, xNewFolder); log.println("Got the new folder: " + utils.getImplName(xNewFolder)); diff --git a/ucb/qa/complex/tdoc/interfaces/_XChild.java b/ucb/qa/complex/tdoc/interfaces/_XChild.java index e6e3c11919ab..351fc6f84aa1 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XChild.java +++ b/ucb/qa/complex/tdoc/interfaces/_XChild.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XChild.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java index ba6090f2b5a8..9800c5c0a398 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java +++ b/ucb/qa/complex/tdoc/interfaces/_XCommandInfoChangeNotifier.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XCommandInfoChangeNotifier.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java b/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java index 44640c4483ac..2fc31a4bd586 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java +++ b/ucb/qa/complex/tdoc/interfaces/_XCommandProcessor.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XCommandProcessor.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XComponent.java b/ucb/qa/complex/tdoc/interfaces/_XComponent.java index 26968baee621..1716e51d1358 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XComponent.java +++ b/ucb/qa/complex/tdoc/interfaces/_XComponent.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XComponent.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XContent.java b/ucb/qa/complex/tdoc/interfaces/_XContent.java index 13a7dfb55d70..4c84ecc1d8df 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XContent.java +++ b/ucb/qa/complex/tdoc/interfaces/_XContent.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XContent.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java index da212766c12f..790f295c7be5 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java +++ b/ucb/qa/complex/tdoc/interfaces/_XPropertiesChangeNotifier.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XPropertiesChangeNotifier.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java b/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java index d3f0b6ac73d6..fd7ff94c8f8f 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java +++ b/ucb/qa/complex/tdoc/interfaces/_XPropertyContainer.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XPropertyContainer.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java b/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java index 9820df929a3a..ec1d7d64ada5 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java +++ b/ucb/qa/complex/tdoc/interfaces/_XPropertySetInfoChangeNotifier.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XPropertySetInfoChangeNotifier.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java b/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java index 17161dc1e0e2..761cca87998a 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java +++ b/ucb/qa/complex/tdoc/interfaces/_XServiceInfo.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XServiceInfo.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java b/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java index 7e56b1ca1e8a..aef931bdeef1 100755 --- a/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java +++ b/ucb/qa/complex/tdoc/interfaces/_XTypeProvider.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: _XTypeProvider.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/interfaces/makefile.mk b/ucb/qa/complex/tdoc/interfaces/makefile.mk index e62ec14be250..3a57d1501ca4 100755 --- a/ucb/qa/complex/tdoc/interfaces/makefile.mk +++ b/ucb/qa/complex/tdoc/interfaces/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4.32.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/tdoc/makefile.mk b/ucb/qa/complex/tdoc/makefile.mk index 5a25db74cfd0..175184de0f27 100755 --- a/ucb/qa/complex/tdoc/makefile.mk +++ b/ucb/qa/complex/tdoc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7.32.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/ucb/UCB.java b/ucb/qa/complex/ucb/UCB.java index 63f9b6d6fb54..f7b1d2a8e918 100755 --- a/ucb/qa/complex/ucb/UCB.java +++ b/ucb/qa/complex/ucb/UCB.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: UCB.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/complex/ucb/makefile.mk b/ucb/qa/complex/ucb/makefile.mk index e0285e70d362..4664bd3cfae7 100755 --- a/ucb/qa/complex/ucb/makefile.mk +++ b/ucb/qa/complex/ucb/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4.32.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/qa/unoapi/makefile.mk b/ucb/qa/unoapi/makefile.mk index 556e93f97d34..1ceb8eb64112 100644 --- a/ucb/qa/unoapi/makefile.mk +++ b/ucb/qa/unoapi/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index 746d86b016dc..e5c879448338 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachedcontentresultset.cxx,v $ - * $Revision: 1.14.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cachedcontentresultset.hxx b/ucb/source/cacher/cachedcontentresultset.hxx index e74051e83886..f2ab5dce2505 100644 --- a/ucb/source/cacher/cachedcontentresultset.hxx +++ b/ucb/source/cacher/cachedcontentresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachedcontentresultset.hxx,v $ - * $Revision: 1.5.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx index baedfa0824af..cb0685a020f5 100644 --- a/ucb/source/cacher/cachedcontentresultsetstub.cxx +++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachedcontentresultsetstub.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cachedcontentresultsetstub.hxx b/ucb/source/cacher/cachedcontentresultsetstub.hxx index 5df4235a0e31..59394e232dde 100644 --- a/ucb/source/cacher/cachedcontentresultsetstub.hxx +++ b/ucb/source/cacher/cachedcontentresultsetstub.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachedcontentresultsetstub.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cacheddynamicresultset.cxx b/ucb/source/cacher/cacheddynamicresultset.cxx index 2037141fac83..ad7bf9f9686c 100644 --- a/ucb/source/cacher/cacheddynamicresultset.cxx +++ b/ucb/source/cacher/cacheddynamicresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheddynamicresultset.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cacheddynamicresultset.hxx b/ucb/source/cacher/cacheddynamicresultset.hxx index 846d303c2f94..ba57238e47c0 100644 --- a/ucb/source/cacher/cacheddynamicresultset.hxx +++ b/ucb/source/cacher/cacheddynamicresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheddynamicresultset.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.cxx b/ucb/source/cacher/cacheddynamicresultsetstub.cxx index 9b012d5a5135..09c5f029d4ac 100644 --- a/ucb/source/cacher/cacheddynamicresultsetstub.cxx +++ b/ucb/source/cacher/cacheddynamicresultsetstub.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheddynamicresultsetstub.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.hxx b/ucb/source/cacher/cacheddynamicresultsetstub.hxx index 3ec790a0cf9c..33608e88f4e2 100644 --- a/ucb/source/cacher/cacheddynamicresultsetstub.hxx +++ b/ucb/source/cacher/cacheddynamicresultsetstub.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheddynamicresultsetstub.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/cacheserv.cxx b/ucb/source/cacher/cacheserv.cxx index e1120b64eff7..3aa0f1de5357 100644 --- a/ucb/source/cacher/cacheserv.cxx +++ b/ucb/source/cacher/cacheserv.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cacheserv.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index 7261cb38df09..092fc3faf29f 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contentresultsetwrapper.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx index a4d453169dfe..b3608aca6f96 100644 --- a/ucb/source/cacher/contentresultsetwrapper.hxx +++ b/ucb/source/cacher/contentresultsetwrapper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: contentresultsetwrapper.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx index f73aab3baba5..ab98c97bc4e2 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.cxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dynamicresultsetwrapper.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/dynamicresultsetwrapper.hxx b/ucb/source/cacher/dynamicresultsetwrapper.hxx index 1745465068ae..47ff822a6ce1 100644 --- a/ucb/source/cacher/dynamicresultsetwrapper.hxx +++ b/ucb/source/cacher/dynamicresultsetwrapper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dynamicresultsetwrapper.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/cacher/makefile.mk b/ucb/source/cacher/makefile.mk index 09717b3f0f7e..20179f8ce7a2 100644 --- a/ucb/source/cacher/makefile.mk +++ b/ucb/source/cacher/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.13 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/cmdenv.cxx b/ucb/source/core/cmdenv.cxx new file mode 100644 index 000000000000..0f425e814400 --- /dev/null +++ b/ucb/source/core/cmdenv.cxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_ucb.hxx" + +#include "cppuhelper/factory.hxx" +#include "com/sun/star/lang/IllegalArgumentException.hpp" + +#include "cmdenv.hxx" + +/************************************************************************** + TODO + ************************************************************************** + + *************************************************************************/ +using namespace com::sun::star; +using namespace ucb_cmdenv; + +//========================================================================= +//========================================================================= +// +// UcbCommandEnvironment Implementation. +// +//========================================================================= +//========================================================================= + +UcbCommandEnvironment::UcbCommandEnvironment( + const uno::Reference< lang::XMultiServiceFactory >& /*xSMgr*/ ) +//: m_xSMgr( xSMgr ) +{ +} + +//========================================================================= +// virtual +UcbCommandEnvironment::~UcbCommandEnvironment() +{ +} + +//========================================================================= +// +// XInitialization methods. +// +//========================================================================= + +// virtual +void SAL_CALL UcbCommandEnvironment::initialize( + const uno::Sequence< uno::Any >& aArguments ) + throw( uno::Exception, + uno::RuntimeException ) +{ + if ( ( aArguments.getLength() < 2 ) || + !( aArguments[ 0 ] >>= m_xIH ) || + !( aArguments[ 1 ] >>= m_xPH )) + throw lang::IllegalArgumentException(); +} + +//========================================================================= +// +// XServiceInfo methods. +// +//========================================================================= + +// virtual +::rtl::OUString SAL_CALL UcbCommandEnvironment::getImplementationName() + throw ( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + +//========================================================================= +// virtual +sal_Bool SAL_CALL +UcbCommandEnvironment::supportsService( const ::rtl::OUString& ServiceName ) + throw ( uno::RuntimeException ) +{ + uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); + const rtl::OUString * pArray = aSNL.getConstArray(); + for ( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + { + if ( pArray[ i ] == ServiceName ) + return sal_True; + } + return sal_False; +} + +//========================================================================= +// virtual +uno::Sequence< ::rtl::OUString > SAL_CALL +UcbCommandEnvironment::getSupportedServiceNames() + throw ( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +//========================================================================= +// static +rtl::OUString UcbCommandEnvironment::getImplementationName_Static() +{ + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.ucb.CommandEnvironment" ) ); +} + +//========================================================================= +// static +uno::Sequence< rtl::OUString > +UcbCommandEnvironment::getSupportedServiceNames_Static() +{ + uno::Sequence< rtl::OUString > aSNS( 1 ); + aSNS.getArray()[ 0 ] + = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.ucb.CommandEnvironment" ) ); + return aSNS; +} + +//========================================================================= +// +// XCommandInfo methods. +// +//========================================================================= + +// virtual +uno::Reference< task::XInteractionHandler > SAL_CALL +UcbCommandEnvironment::getInteractionHandler() + throw ( uno::RuntimeException ) +{ + return m_xIH; +} + +//========================================================================= +// virtual +uno::Reference< ucb::XProgressHandler > SAL_CALL +UcbCommandEnvironment::getProgressHandler() + throw ( uno::RuntimeException ) +{ + return m_xPH; +} + +//========================================================================= +// +// Service factory implementation. +// +//========================================================================= + +static uno::Reference< uno::XInterface > SAL_CALL +UcbCommandEnvironment_CreateInstance( + const uno::Reference< lang::XMultiServiceFactory> & rSMgr ) + throw( uno::Exception ) +{ + lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >( + new UcbCommandEnvironment( rSMgr ) ); + return uno::Reference< uno::XInterface >::query( pX ); +} + +//========================================================================= +// static +uno::Reference< lang::XSingleServiceFactory > +UcbCommandEnvironment::createServiceFactory( + const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr ) +{ + return uno::Reference< lang::XSingleServiceFactory >( + cppu::createOneInstanceFactory( + rxServiceMgr, + UcbCommandEnvironment::getImplementationName_Static(), + UcbCommandEnvironment_CreateInstance, + UcbCommandEnvironment::getSupportedServiceNames_Static() ) ); +} diff --git a/ucb/source/core/cmdenv.hxx b/ucb/source/core/cmdenv.hxx new file mode 100644 index 000000000000..419ce6afb560 --- /dev/null +++ b/ucb/source/core/cmdenv.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_CMDENV_HXX +#define INCLUDED_CMDENV_HXX + +#include "cppuhelper/implbase3.hxx" + +#include "com/sun/star/lang/XInitialization.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" + +namespace ucb_cmdenv { + +class UcbCommandEnvironment : + public cppu::WeakImplHelper3< com::sun::star::lang::XInitialization, + com::sun::star::lang::XServiceInfo, + com::sun::star::ucb::XCommandEnvironment > +{ + com::sun::star::uno::Reference< + com::sun::star::task::XInteractionHandler > m_xIH; + com::sun::star::uno::Reference< + com::sun::star::ucb::XProgressHandler > m_xPH; + +public: + UcbCommandEnvironment( + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory >& rXSMgr ); + virtual ~UcbCommandEnvironment(); + + // XInitialization + virtual void SAL_CALL + initialize( const com::sun::star::uno::Sequence< + com::sun::star::uno::Any >& aArguments ) + throw( com::sun::star::uno::Exception, + 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 ); + + // XCommandEnvironment + virtual com::sun::star::uno::Reference< + com::sun::star::task::XInteractionHandler > SAL_CALL + getInteractionHandler() + throw ( com::sun::star::uno::RuntimeException ); + virtual com::sun::star::uno::Reference< + com::sun::star::ucb::XProgressHandler > SAL_CALL + getProgressHandler() + throw ( com::sun::star::uno::RuntimeException ); + + // Non-UNO interfaces + static rtl::OUString + getImplementationName_Static(); + static com::sun::star::uno::Sequence< rtl::OUString > + getSupportedServiceNames_Static(); + + static com::sun::star::uno::Reference< + com::sun::star::lang::XSingleServiceFactory > + createServiceFactory( const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > & rxServiceMgr ); +private: + //com::sun::star::uno::Reference< + // com::sun::star::lang::XMultiServiceFactory > m_xSMgr; +}; + +} // namespace ucb_cmdenv + +#endif // INCLUDED_CMDENV_HXX diff --git a/ucb/source/core/identify.cxx b/ucb/source/core/identify.cxx index 956f5c2f582d..ece9211c1ac3 100644 --- a/ucb/source/core/identify.cxx +++ b/ucb/source/core/identify.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: identify.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/identify.hxx b/ucb/source/core/identify.hxx index 0cd59aedeaf1..d8ea23b1eee5 100644 --- a/ucb/source/core/identify.hxx +++ b/ucb/source/core/identify.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: identify.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/makefile.mk b/ucb/source/core/makefile.mk index e70b5ca879ef..5095dbef947d 100644 --- a/ucb/source/core/makefile.mk +++ b/ucb/source/core/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.22 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -48,7 +44,8 @@ SLOFILES=\ $(SLO)$/ucbstore.obj \ $(SLO)$/ucbprops.obj \ $(SLO)$/provprox.obj \ - $(SLO)$/ucbcmds.obj + $(SLO)$/ucbcmds.obj \ + $(SLO)$/cmdenv.obj LIB1TARGET=$(SLB)$/_$(TARGET).lib LIB1OBJFILES=$(SLOFILES) @@ -59,7 +56,7 @@ SHL1STDLIBS=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ - $(UCBHELPERLIB) + $(UCBHELPERLIB) SHL1LIBS=\ $(LIB1TARGET) \ $(SLB)$/regexp.lib diff --git a/ucb/source/core/providermap.hxx b/ucb/source/core/providermap.hxx index 8a464cd1d2bf..a7fec30a42bf 100644 --- a/ucb/source/core/providermap.hxx +++ b/ucb/source/core/providermap.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: providermap.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx index 64011230bd37..feab9ce4f95e 100644 --- a/ucb/source/core/provprox.cxx +++ b/ucb/source/core/provprox.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: provprox.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/provprox.hxx b/ucb/source/core/provprox.hxx index 9dda8a247ac4..cdc85251e96e 100644 --- a/ucb/source/core/provprox.hxx +++ b/ucb/source/core/provprox.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: provprox.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index fe20f6e5b23a..094507a56c24 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucb.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx index e03e6f3c6ab5..0e44c5bc99b5 100644 --- a/ucb/source/core/ucb.hxx +++ b/ucb/source/core/ucb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucb.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index 7caabc7f783d..fd3f0f73c772 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbcmds.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,11 +38,10 @@ #include <cppuhelper/exc_hlp.hxx> #include <rtl/ustring.h> #include <rtl/ustring.hxx> -#ifndef __COM_SUN_STAR_LANG_XINTERFACE_HPP_ #include <com/sun/star/uno/XInterface.hpp> -#endif #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/io/XActiveDataSink.hpp> @@ -53,13 +49,12 @@ #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/ucb/CommandEnvironment.hpp> #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/GlobalTransferCommandArgument.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> -#endif #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/ucb/NameClashException.hpp> #include <com/sun/star/ucb/OpenCommandArgument2.hpp> @@ -79,7 +74,7 @@ using namespace com::sun::star; -namespace ucb_commands +namespace { //========================================================================= @@ -182,51 +177,6 @@ void SAL_CALL InteractionHandlerProxy::handle( //========================================================================= // -// class CommandEnvironment. -// -//========================================================================= - -class CommandEnvironment : - public cppu::WeakImplHelper1< ucb::XCommandEnvironment > -{ - uno::Reference< task::XInteractionHandler > m_xIH; - uno::Reference< ucb::XProgressHandler > m_xPH; - -public: - CommandEnvironment( - const uno::Reference< task::XInteractionHandler > & xIH, - const uno::Reference< ucb::XProgressHandler > & xPH ) - : m_xIH( xIH ), m_xPH( xPH ) {} - - // XCommandEnvironment methods. - virtual uno::Reference< task::XInteractionHandler > SAL_CALL - getInteractionHandler() - throw ( uno::RuntimeException ); - virtual uno::Reference< ucb::XProgressHandler > SAL_CALL - getProgressHandler() - throw ( uno::RuntimeException ); -}; - -//========================================================================= -// virtual -uno::Reference< task::XInteractionHandler > SAL_CALL -CommandEnvironment::getInteractionHandler() - throw ( uno::RuntimeException ) -{ - return m_xIH; -} - -//========================================================================= -// virtual -uno::Reference< ucb::XProgressHandler > SAL_CALL -CommandEnvironment::getProgressHandler() - throw ( uno::RuntimeException ) -{ - return m_xPH; -} - -//========================================================================= -// // class ActiveDataSink. // //========================================================================= @@ -389,7 +339,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle ) //========================================================================= //========================================================================= -static rtl::OUString createDesiredName( +rtl::OUString createDesiredName( const rtl::OUString & rSourceURL, const rtl::OUString & rNewTitle ) { rtl::OUString aName( rNewTitle ); @@ -438,13 +388,13 @@ static rtl::OUString createDesiredName( return rtl::OUString( aName ); } -static rtl::OUString createDesiredName( +rtl::OUString createDesiredName( const ucb::GlobalTransferCommandArgument & rArg ) { return createDesiredName( rArg.SourceURL, rArg.NewTitle ); } -static rtl::OUString createDesiredName( +rtl::OUString createDesiredName( const ucb::TransferInfo & rArg ) { return createDesiredName( rArg.SourceURL, rArg.NewTitle ); @@ -453,7 +403,7 @@ static rtl::OUString createDesiredName( //========================================================================= enum NameClashContinuation { NOT_HANDLED, ABORT, OVERWRITE, NEW_NAME, UNKNOWN }; -static NameClashContinuation interactiveNameClashResolve( +NameClashContinuation interactiveNameClashResolve( const uno::Reference< ucb::XCommandEnvironment > & xEnv, const rtl::OUString & rTargetURL, const rtl::OUString & rClashingName, @@ -528,7 +478,7 @@ static NameClashContinuation interactiveNameClashResolve( } //========================================================================= -static bool setTitle( +bool setTitle( const uno::Reference< ucb::XCommandProcessor > & xCommandProcessor, const uno::Reference< ucb::XCommandEnvironment > & xEnv, const rtl::OUString & rNewTitle ) @@ -576,7 +526,7 @@ static bool setTitle( } //========================================================================= -static uno::Reference< ucb::XContent > createNew( +uno::Reference< ucb::XContent > createNew( const TransferCommandContext & rContext, const uno::Reference< ucb::XContent > & xTarget, sal_Bool bSourceIsFolder, @@ -590,10 +540,12 @@ static uno::Reference< ucb::XContent > createNew( // ////////////////////////////////////////////////////////////////////// - uno::Reference< ucb::XContentCreator > xCreator( - xTarget, uno::UNO_QUERY ); + // First, try it using "CreatabeleContentsInfo" property and + // "createNewContent" command -> the "new" way. - if ( !xCreator.is() ) + uno::Reference< ucb::XCommandProcessor > xCommandProcessorT( + xTarget, uno::UNO_QUERY ); + if ( !xCommandProcessorT.is() ) { uno::Any aProps = uno::makeAny(beans::PropertyValue( @@ -606,24 +558,77 @@ static uno::Reference< ucb::XContent > createNew( ucb::IOErrorCode_CANT_CREATE, uno::Sequence< uno::Any >(&aProps, 1), rContext.xOrigEnv, - rtl::OUString::createFromAscii( "Target is no XContentCreator!" ), + rtl::OUString::createFromAscii( "Target is no XCommandProcessor!" ), rContext.xProcessor ); // Unreachable } - uno::Sequence< ucb::ContentInfo > aTypesInfo - = xCreator->queryCreatableContentsInfo(); + uno::Sequence< beans::Property > aPropsToObtain( 1 ); + aPropsToObtain[ 0 ].Name + = rtl::OUString::createFromAscii( "CreatableContentsInfo" ); + aPropsToObtain[ 0 ].Handle + = -1; - sal_Int32 nCount = aTypesInfo.getLength(); - if ( !nCount ) + ucb::Command aGetPropsCommand( + rtl::OUString::createFromAscii( "getPropertyValues" ), + -1, + uno::makeAny( aPropsToObtain ) ); + + uno::Reference< sdbc::XRow > xRow; + xCommandProcessorT->execute( aGetPropsCommand, 0, rContext.xEnv ) >>= xRow; + + uno::Sequence< ucb::ContentInfo > aTypesInfo; + bool bGotTypesInfo = false; + + if ( xRow.is() ) { - uno::Any aProps - = uno::makeAny(beans::PropertyValue( + uno::Any aValue = xRow->getObject( + 1, uno::Reference< container::XNameAccess >() ); + if ( aValue.hasValue() && ( aValue >>= aTypesInfo ) ) + { + bGotTypesInfo = true; + } + } + + uno::Reference< ucb::XContentCreator > xCreator; + + if ( !bGotTypesInfo ) + { + // Second, try it using XContentCreator interface -> the "old" way (not + // providing the chance to supply an XCommandEnvironment. + + xCreator.set( xTarget, uno::UNO_QUERY ); + + if ( !xCreator.is() ) + { + uno::Any aProps + = uno::makeAny(beans::PropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Folder")), -1, uno::makeAny(rContext.aArg.TargetURL), beans::PropertyState_DIRECT_VALUE)); + ucbhelper::cancelCommandExecution( + ucb::IOErrorCode_CANT_CREATE, + uno::Sequence< uno::Any >(&aProps, 1), + rContext.xOrigEnv, + rtl::OUString::createFromAscii( "Target is no XContentCreator!" ), + rContext.xProcessor ); + // Unreachable + } + + aTypesInfo = xCreator->queryCreatableContentsInfo(); + } + + sal_Int32 nCount = aTypesInfo.getLength(); + if ( !nCount ) + { + uno::Any aProps + = uno::makeAny(beans::PropertyValue( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Folder")), + -1, + uno::makeAny(rContext.aArg.TargetURL), + beans::PropertyState_DIRECT_VALUE)); ucbhelper::cancelCommandExecution( ucb::IOErrorCode_CANT_CREATE, uno::Sequence< uno::Any >(&aProps, 1), @@ -680,7 +685,7 @@ static uno::Reference< ucb::XContent > createNew( !!( nAttribs & ucb::ContentInfoAttribute::KIND_FOLDER ) ) && - ( !!bSourceIsDocument == + ( !!bSourceIsDocument == !!( nAttribs & ucb::ContentInfoAttribute::KIND_DOCUMENT ) ) ) @@ -710,7 +715,25 @@ static uno::Reference< ucb::XContent > createNew( // ////////////////////////////////////////////////////////////// - xNew = xCreator->createNewContent( aTypesInfo[ n ] ); + if ( !xCreator.is() ) + { + // First, try it using "CreatabeleContentsInfo" property and + // "createNewContent" command -> the "new" way. + ucb::Command aCreateNewCommand( + rtl::OUString::createFromAscii( "createNewContent" ), + -1, + uno::makeAny( aTypesInfo[ n ] ) ); + + xCommandProcessorT->execute( aCreateNewCommand, 0, rContext.xEnv ) + >>= xNew; + } + else + { + // Second, try it using XContentCreator interface -> the "old" + // way (not providing the chance to supply an XCommandEnvironment. + + xNew = xCreator->createNewContent( aTypesInfo[ n ] ); + } if ( !xNew.is() ) { @@ -739,7 +762,7 @@ static uno::Reference< ucb::XContent > createNew( } //========================================================================= -static void transferProperties( +void transferProperties( const TransferCommandContext & rContext, const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS, const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorN ) @@ -904,7 +927,7 @@ static void transferProperties( } //========================================================================= -static uno::Reference< io::XInputStream > getInputStream( +uno::Reference< io::XInputStream > getInputStream( const TransferCommandContext & rContext, const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS ) throw( uno::Exception ) @@ -992,7 +1015,7 @@ static uno::Reference< io::XInputStream > getInputStream( } //========================================================================= -static uno::Reference< sdbc::XResultSet > getResultSet( +uno::Reference< sdbc::XResultSet > getResultSet( const TransferCommandContext & rContext, const uno::Reference< ucb::XCommandProcessor > & xCommandProcessorS ) throw( uno::Exception ) @@ -1038,7 +1061,7 @@ static uno::Reference< sdbc::XResultSet > getResultSet( } //========================================================================= -static void handleNameClashRename( +void handleNameClashRename( const TransferCommandContext & rContext, const uno::Reference< ucb::XContent > & xNew, const uno::Reference< @@ -1217,7 +1240,7 @@ static void handleNameClashRename( } //========================================================================= -static void globalTransfer( +void globalTransfer_( const TransferCommandContext & rContext, const uno::Reference< ucb::XContent > & xSource, const uno::Reference< ucb::XContent > & xTarget, @@ -1632,7 +1655,7 @@ static void globalTransfer( rtl::OUString(), // NewTitle; rContext.aArg.NameClash ); // NameClash - ucb_commands::TransferCommandContext aSubCtx( + TransferCommandContext aSubCtx( rContext.xSMgr, rContext.xProcessor, rContext.xEnv, @@ -1649,10 +1672,10 @@ static void globalTransfer( aSubCtx.aArg.SourceURL = xChild->getIdentifier()->getContentIdentifier(); - ucb_commands::globalTransfer( aSubCtx, - xChild, - xNew, - xChildRow ); + globalTransfer_( aSubCtx, + xChild, + xNew, + xChildRow ); } } while ( xResultSet->next() ); @@ -1695,7 +1718,7 @@ static void globalTransfer( } } -} /* namescpace ucb_commands */ +} /* namescpace */ //========================================================================= // @@ -1706,8 +1729,7 @@ static void globalTransfer( uno::Reference< ucb::XCommandInfo > UniversalContentBroker::getCommandInfo() { - return uno::Reference< ucb::XCommandInfo >( - new ucb_commands::CommandProcessorInfo() ); + return uno::Reference< ucb::XCommandInfo >( new CommandProcessorInfo() ); } //========================================================================= @@ -1717,14 +1739,24 @@ void UniversalContentBroker::globalTransfer( throw( uno::Exception ) { // Use own command environment with own interaction handler intercepting - // some interaction requests that shell not be handled by the user-supplied + // some interaction requests that shall not be handled by the user-supplied // interaction handler. uno::Reference< ucb::XCommandEnvironment > xLocalEnv; if (xEnv.is()) - xLocalEnv.set( new ucb_commands::CommandEnvironment( - new ucb_commands::InteractionHandlerProxy( - xEnv->getInteractionHandler() ), - xEnv->getProgressHandler() ) ); + { + uno::Reference< beans::XPropertySet > const xProps( + m_xSMgr, uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xCtx; + xCtx.set( xProps->getPropertyValue( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), + uno::UNO_QUERY_THROW ); + + xLocalEnv.set( ucb::CommandEnvironment::create( + xCtx, + new InteractionHandlerProxy( xEnv->getInteractionHandler() ), + xEnv->getProgressHandler() ) ); + } ////////////////////////////////////////////////////////////////////// // @@ -1862,27 +1894,27 @@ void UniversalContentBroker::globalTransfer( uno::Any aExc; rtl::OUString aNewTitle; - ucb_commands::NameClashContinuation eCont - = ucb_commands::interactiveNameClashResolve( + NameClashContinuation eCont + = interactiveNameClashResolve( xEnv, // always use original environment! rArg.TargetURL, // target folder URL - ucb_commands::createDesiredName( - aTransferArg ), // clashing name + createDesiredName( + aTransferArg ), // clashing name aExc, aNewTitle ); switch ( eCont ) { - case ucb_commands::NOT_HANDLED: + case NOT_HANDLED: // Not handled. cppu::throwException( aExc ); // break; - case ucb_commands::UNKNOWN: + case UNKNOWN: // Handled, but not clear, how... // fall-thru intended. - case ucb_commands::ABORT: + case ABORT: throw ucb::CommandFailedException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -1892,13 +1924,13 @@ void UniversalContentBroker::globalTransfer( aExc ); // break; - case ucb_commands::OVERWRITE: + case OVERWRITE: aTransferArg.NameClash = ucb::NameClash::OVERWRITE; bRetry = true; break; - case ucb_commands::NEW_NAME: + case NEW_NAME: aTransferArg.NewTitle = aNewTitle; bRetry = true; break; @@ -2015,7 +2047,7 @@ void UniversalContentBroker::globalTransfer( // Unreachable } - ucb_commands::TransferCommandContext aTransferCtx( + TransferCommandContext aTransferCtx( m_xSMgr, this, xLocalEnv, xEnv, rArg ); if ( rArg.NewTitle.getLength() == 0 ) @@ -2025,12 +2057,12 @@ void UniversalContentBroker::globalTransfer( if ( aBaseURI.getLength() ) { aTransferCtx.aArg.NewTitle - = ucb_commands::createDesiredName( aBaseURI, rtl::OUString() ); + = createDesiredName( aBaseURI, rtl::OUString() ); } } // Do it! - ucb_commands::globalTransfer( aTransferCtx, xSource, xTarget, xRow ); + globalTransfer_( aTransferCtx, xSource, xTarget, xRow ); ////////////////////////////////////////////////////////////////////// // diff --git a/ucb/source/core/ucbcmds.hxx b/ucb/source/core/ucbcmds.hxx index 5e13ea1b41ff..7e50bcceef93 100644 --- a/ucb/source/core/ucbcmds.hxx +++ b/ucb/source/core/ucbcmds.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbcmds.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucbprops.cxx b/ucb/source/core/ucbprops.cxx index 9bfb3de558a3..564383fd528a 100644 --- a/ucb/source/core/ucbprops.cxx +++ b/ucb/source/core/ucbprops.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbprops.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucbprops.hxx b/ucb/source/core/ucbprops.hxx index a0f71b6818ca..7908fa6af90c 100644 --- a/ucb/source/core/ucbprops.hxx +++ b/ucb/source/core/ucbprops.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbprops.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/core/ucbserv.cxx b/ucb/source/core/ucbserv.cxx index 17630a8ef210..340fa5db0c0f 100644 --- a/ucb/source/core/ucbserv.cxx +++ b/ucb/source/core/ucbserv.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbserv.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -37,6 +34,7 @@ #include "ucbstore.hxx" #include "ucbprops.hxx" #include "provprox.hxx" +#include "cmdenv.hxx" using namespace rtl; using namespace com::sun::star::uno; @@ -46,7 +44,7 @@ using namespace com::sun::star::registry; //========================================================================= static sal_Bool writeInfo( void * pRegistryKey, const OUString & rImplementationName, - Sequence< OUString > const & rServiceNames ) + Sequence< OUString > const & rServiceNames ) { OUString aKeyName( OUString::createFromAscii( "/" ) ); aKeyName += rImplementationName; @@ -124,7 +122,15 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) writeInfo( pRegistryKey, UcbContentProviderProxyFactory::getImplementationName_Static(), - UcbContentProviderProxyFactory::getSupportedServiceNames_Static() ); + UcbContentProviderProxyFactory::getSupportedServiceNames_Static() ) && + + ////////////////////////////////////////////////////////////////////// + // Command Environment. + ////////////////////////////////////////////////////////////////////// + + writeInfo( pRegistryKey, + ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static(), + ucb_cmdenv::UcbCommandEnvironment::getSupportedServiceNames_Static() ); } //========================================================================= @@ -179,6 +185,17 @@ extern "C" void * SAL_CALL component_getFactory( } ////////////////////////////////////////////////////////////////////// + // Command Environment. + ////////////////////////////////////////////////////////////////////// + + else if ( ucb_cmdenv::UcbCommandEnvironment::getImplementationName_Static(). + compareToAscii( pImplName ) == 0 ) + { + xFactory + = ucb_cmdenv::UcbCommandEnvironment::createServiceFactory( xSMgr ); + } + + ////////////////////////////////////////////////////////////////////// if ( xFactory.is() ) { diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 40c8984d080f..9500db4f45b6 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbstore.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1570,7 +1567,9 @@ void SAL_CALL PersistentPropertySet::setPropertyValue( // Write state ( Now it is a directly set value ) xNameReplace->replaceByName( OUString::createFromAscii( "State" ), - makeAny( PropertyState_DIRECT_VALUE ) ); + makeAny( + sal_Int32( + PropertyState_DIRECT_VALUE ) ) ); // Commit changes. xBatch->commitChanges(); @@ -1854,7 +1853,9 @@ void SAL_CALL PersistentPropertySet::addProperty( // Set state ( always "default" ) xNameReplace->replaceByName( OUString::createFromAscii( "State" ), - makeAny( PropertyState_DEFAULT_VALUE ) ); + makeAny( + sal_Int32( + PropertyState_DEFAULT_VALUE ) ) ); // Set attributes xNameReplace->replaceByName( @@ -2330,7 +2331,9 @@ void SAL_CALL PersistentPropertySet::setPropertyValues( // Write state ( Now it is a directly set value ) xNameReplace->replaceByName( OUString::createFromAscii( "State" ), - makeAny( PropertyState_DIRECT_VALUE ) ); + makeAny( + sal_Int32( + PropertyState_DIRECT_VALUE ) ) ); // Commit changes. xBatch->commitChanges(); diff --git a/ucb/source/core/ucbstore.hxx b/ucb/source/core/ucbstore.hxx index ac420708f904..8c339337f890 100644 --- a/ucb/source/core/ucbstore.hxx +++ b/ucb/source/core/ucbstore.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbstore.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/inc/regexp.hxx b/ucb/source/inc/regexp.hxx index f396c9f5419b..ddfed2994108 100644 --- a/ucb/source/inc/regexp.hxx +++ b/ucb/source/inc/regexp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: regexp.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/inc/regexpmap.hxx b/ucb/source/inc/regexpmap.hxx index 631291f5cf0a..3bff4e619073 100644 --- a/ucb/source/inc/regexpmap.hxx +++ b/ucb/source/inc/regexpmap.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: regexpmap.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/inc/regexpmap.tpt b/ucb/source/inc/regexpmap.tpt index 084867e07f06..9d4a7fb69c82 100644 --- a/ucb/source/inc/regexpmap.tpt +++ b/ucb/source/inc/regexpmap.tpt @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: regexpmap.tpt,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/regexp/makefile.mk b/ucb/source/regexp/makefile.mk index 8d0b938402e8..e748f054ea13 100644 --- a/ucb/source/regexp/makefile.mk +++ b/ucb/source/regexp/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx index d035cf523aff..f784532d31b3 100644 --- a/ucb/source/regexp/regexp.cxx +++ b/ucb/source/regexp/regexp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: regexp.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/makefile.mk b/ucb/source/sorter/makefile.mk index bcd3b644476a..5077be80b411 100644 --- a/ucb/source/sorter/makefile.mk +++ b/ucb/source/sorter/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.14 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index 70881878b2cf..2fc38ee46a42 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sortdynres.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/sortdynres.hxx b/ucb/source/sorter/sortdynres.hxx index 9b9296e87d86..fe026d40a3f7 100644 --- a/ucb/source/sorter/sortdynres.hxx +++ b/ucb/source/sorter/sortdynres.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sortdynres.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/sortmain.cxx b/ucb/source/sorter/sortmain.cxx index 44a0b715aa9c..d96b4bcff796 100644 --- a/ucb/source/sorter/sortmain.cxx +++ b/ucb/source/sorter/sortmain.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sortmain.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 3e89d7e20d2d..6e546950a23a 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sortresult.cxx,v $ - * $Revision: 1.18.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx index 659801df578c..3817152f3d6c 100644 --- a/ucb/source/sorter/sortresult.hxx +++ b/ucb/source/sorter/sortresult.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sortresult.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/expand/makefile.mk b/ucb/source/ucp/expand/makefile.mk index 6b4ffc8581be..aaa7b85edbf1 100644 --- a/ucb/source/ucp/expand/makefile.mk +++ b/ucb/source/ucp/expand/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx index 9e9d11503143..710cf137ba06 100644 --- a/ucb/source/ucp/expand/ucpexpand.cxx +++ b/ucb/source/ucp/expand/ucpexpand.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucpexpand.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index beb366b07ca5..b78e5d6e4890 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bc.cxx,v $ - * $Revision: 1.40 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,7 +46,6 @@ #include <com/sun/star/beans/PropertySetInfoChange.hpp> #include <com/sun/star/ucb/ContentAction.hpp> #include <com/sun/star/ucb/NameClash.hpp> -#include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include "filglob.hxx" #include "filid.hxx" #include "filrow.hxx" @@ -437,6 +433,15 @@ BaseContent::execute( const Command& aCommand, if(!xRow->wasNull()) aAny <<= CasePreservingURL; } + else if( ! aCommand.Name.compareToAscii( "createNewContent" ) ) + { + ucb::ContentInfo aArg; + if ( !( aCommand.Argument >>= aArg ) ) + m_pMyShell->installError( CommandId, + TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT ); + else + aAny <<= createNewContent( aArg ); + } else m_pMyShell->installError( CommandId, TASKHANDLER_UNSUPPORTED_COMMAND ); @@ -529,9 +534,9 @@ BaseContent::getContentType() // Who am I ? Sequence< beans::Property > seq(1); seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"), - -1, - getCppuType( static_cast< sal_Bool* >(0) ), - 0 ); + -1, + getCppuType( static_cast< sal_Bool* >(0) ), + 0 ); Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq ); sal_Bool IsDocument = xRow->getBoolean( 1 ); @@ -637,27 +642,7 @@ BaseContent::queryCreatableContentsInfo( void ) throw( RuntimeException ) { - Sequence< ContentInfo > seq(2); - - // file - seq[0].Type = m_pMyShell->FileContentType; - seq[0].Attributes = ContentInfoAttribute::INSERT_WITH_INPUTSTREAM - | ContentInfoAttribute::KIND_DOCUMENT; - - Sequence< beans::Property > props( 1 ); - props[0] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< rtl::OUString* >( 0 ) ), - beans::PropertyAttribute::MAYBEVOID - | beans::PropertyAttribute::BOUND ); - seq[0].Properties = props; - - // folder - seq[1].Type = m_pMyShell->FolderContentType; - seq[1].Attributes = ContentInfoAttribute::KIND_FOLDER; - seq[1].Properties = props; - return seq; + return m_pMyShell->queryCreatableContentsInfo(); } @@ -688,18 +673,18 @@ BaseContent::createNewContent( { Sequence< beans::Property > seq(1); seq[0] = beans::Property( rtl::OUString::createFromAscii("IsDocument"), - -1, - getCppuType( static_cast< sal_Bool* >(0) ), - 0 ); + -1, + getCppuType( static_cast< sal_Bool* >(0) ), + 0 ); Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq ); IsDocument = xRow->getBoolean( 1 ); if ( xRow->wasNull() ) { IsDocument = false; -// OSL_ENSURE( false, -// "BaseContent::createNewContent - Property value was null!" ); -// return Reference< XContent >(); +// OSL_ENSURE( false, +// "BaseContent::createNewContent - Property value was null!" ); +// return Reference< XContent >(); } } catch ( sdbc::SQLException const & ) diff --git a/ucb/source/ucp/file/bc.hxx b/ucb/source/ucp/file/bc.hxx index b134e148135e..2163758bfffc 100644 --- a/ucb/source/ucp/file/bc.hxx +++ b/ucb/source/ucp/file/bc.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bc.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filcmd.cxx b/ucb/source/ucp/file/filcmd.cxx index 92001b2dc0e0..776482957c1e 100644 --- a/ucb/source/ucp/file/filcmd.cxx +++ b/ucb/source/ucp/file/filcmd.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filcmd.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filcmd.hxx b/ucb/source/ucp/file/filcmd.hxx index 05ca0fbbc370..6a6725bfcb17 100644 --- a/ucb/source/ucp/file/filcmd.hxx +++ b/ucb/source/ucp/file/filcmd.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filcmd.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filerror.hxx b/ucb/source/ucp/file/filerror.hxx index 0ae47da5629d..35b0d8ae5ce8 100644 --- a/ucb/source/ucp/file/filerror.hxx +++ b/ucb/source/ucp/file/filerror.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filerror.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,21 +39,21 @@ namespace fileaccess { #define TASKHANDLING_WRONG_DELETE_ARGUMENT 5 #define TASKHANDLING_WRONG_TRANSFER_ARGUMENT 6 #define TASKHANDLING_WRONG_INSERT_ARGUMENT 7 +#define TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT 8 +#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 9 -#define TASKHANDLING_UNSUPPORTED_OPEN_MODE 8 - -#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 9 -#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 10 +#define TASKHANDLING_DELETED_STATE_IN_OPEN_COMMAND 10 +#define TASKHANDLING_INSERTED_STATE_IN_OPEN_COMMAND 11 -#define TASKHANDLING_OPEN_FILE_FOR_PAGING 11 -#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 12 -#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 13 -#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 14 -#define TASKHANDLING_READING_FILE_FOR_PAGING 15 +#define TASKHANDLING_OPEN_FILE_FOR_PAGING 12 +#define TASKHANDLING_NOTCONNECTED_FOR_PAGING 13 +#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING 14 +#define TASKHANDLING_IOEXCEPTION_FOR_PAGING 15 +#define TASKHANDLING_READING_FILE_FOR_PAGING 16 -#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 16 -#define TASKHANDLING_OPEN_FOR_STREAM 17 -#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 18 +#define TASKHANDLING_OPEN_FOR_INPUTSTREAM 17 +#define TASKHANDLING_OPEN_FOR_STREAM 18 +#define TASKHANDLING_OPEN_FOR_DIRECTORYLISTING 19 #define TASKHANDLING_NOFRESHINSERT_IN_INSERT_COMMAND 22 #define TASKHANDLING_NONAMESET_INSERT_COMMAND 23 diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx index 25095a4f9082..e947c68da1ba 100644 --- a/ucb/source/ucp/file/filglob.cxx +++ b/ucb/source/ucp/file/filglob.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filglob.cxx,v $ - * $Revision: 1.26.4.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -286,7 +283,8 @@ namespace fileaccess { errorCode == TASKHANDLING_WRONG_OPEN_ARGUMENT || errorCode == TASKHANDLING_WRONG_DELETE_ARGUMENT || errorCode == TASKHANDLING_WRONG_TRANSFER_ARGUMENT || - errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT ) + errorCode == TASKHANDLING_WRONG_INSERT_ARGUMENT || + errorCode == TASKHANDLING_WRONG_CREATENEWCONTENT_ARGUMENT ) { IllegalArgumentException excep; excep.ArgumentPosition = 0; @@ -655,15 +653,15 @@ namespace fileaccess { aAny <<= excep; cancelCommandExecution( aAny,xEnv ); } -// ioErrorCode = IOErrorCode_ALREADY_EXISTING; -// cancelCommandExecution( -// ioErrorCode, -// generateErrorArguments(aUncPath), -// xEnv, -// rtl::OUString( -// RTL_CONSTASCII_USTRINGPARAM( -// "the folder exists")), -// xComProc ); +// ioErrorCode = IOErrorCode_ALREADY_EXISTING; +// cancelCommandExecution( +// ioErrorCode, +// generateErrorArguments(aUncPath), +// xEnv, +// rtl::OUString( +// RTL_CONSTASCII_USTRINGPARAM( +// "the folder exists")), +// xComProc ); } else if( errorCode == TASKHANDLING_ENSUREDIR_FOR_WRITE || errorCode == TASKHANDLING_CREATEDIRECTORY_MKDIR ) @@ -814,20 +812,20 @@ namespace fileaccess { errorCode == TASKHANDLING_TRANSFER_BY_MOVE_SOURCESTAT ) { ioErrorCode = IOErrorCode_NOT_EXISTING; - aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "source file/folder does not exist")); break; } else { ioErrorCode = IOErrorCode_GENERAL; - aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "a general error during transfer command")); break; } default: ioErrorCode = IOErrorCode_GENERAL; - aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + aMsg = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "a general error during transfer command")); break; } diff --git a/ucb/source/ucp/file/filglob.hxx b/ucb/source/ucp/file/filglob.hxx index fd4d6fb96c9c..015128e6588b 100644 --- a/ucb/source/ucp/file/filglob.hxx +++ b/ucb/source/ucp/file/filglob.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filglob.hxx,v $ - * $Revision: 1.11.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filid.cxx b/ucb/source/ucp/file/filid.cxx index fc7009b20e4c..8ccd8980fb9b 100644 --- a/ucb/source/ucp/file/filid.cxx +++ b/ucb/source/ucp/file/filid.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filid.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filid.hxx b/ucb/source/ucp/file/filid.hxx index 9d693c1db767..36c774353120 100644 --- a/ucb/source/ucp/file/filid.hxx +++ b/ucb/source/ucp/file/filid.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filid.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filinl.hxx b/ucb/source/ucp/file/filinl.hxx index 1b9d98ebdc14..d28af751403b 100644 --- a/ucb/source/ucp/file/filinl.hxx +++ b/ucb/source/ucp/file/filinl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filinl.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filinpstr.cxx b/ucb/source/ucp/file/filinpstr.cxx index acd7b4a11421..a66a0daf5def 100644 --- a/ucb/source/ucp/file/filinpstr.cxx +++ b/ucb/source/ucp/file/filinpstr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filinpstr.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filinpstr.hxx b/ucb/source/ucp/file/filinpstr.hxx index 1a45c200f7b3..cb0668c10c82 100644 --- a/ucb/source/ucp/file/filinpstr.hxx +++ b/ucb/source/ucp/file/filinpstr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filinpstr.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filinsreq.cxx b/ucb/source/ucp/file/filinsreq.cxx index 89ae1e307671..586c9a6f3c85 100644 --- a/ucb/source/ucp/file/filinsreq.cxx +++ b/ucb/source/ucp/file/filinsreq.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filinsreq.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filinsreq.hxx b/ucb/source/ucp/file/filinsreq.hxx index 62e377076783..bb78bd4c2973 100644 --- a/ucb/source/ucp/file/filinsreq.hxx +++ b/ucb/source/ucp/file/filinsreq.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filinsreq.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx index fbb72104b71c..0d2d5b4cb9b1 100644 --- a/ucb/source/ucp/file/filnot.cxx +++ b/ucb/source/ucp/file/filnot.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filnot.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filnot.hxx b/ucb/source/ucp/file/filnot.hxx index 4bc12a9c4dba..24f982372328 100644 --- a/ucb/source/ucp/file/filnot.hxx +++ b/ucb/source/ucp/file/filnot.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filnot.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filprp.cxx b/ucb/source/ucp/file/filprp.cxx index 39ff82d95909..86c494cbd710 100644 --- a/ucb/source/ucp/file/filprp.cxx +++ b/ucb/source/ucp/file/filprp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filprp.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filprp.hxx b/ucb/source/ucp/file/filprp.hxx index f3da1b14508c..24d1bf324339 100644 --- a/ucb/source/ucp/file/filprp.hxx +++ b/ucb/source/ucp/file/filprp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filprp.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrec.cxx b/ucb/source/ucp/file/filrec.cxx index 58f12d3162b1..c0e9b02ddb70 100644 --- a/ucb/source/ucp/file/filrec.cxx +++ b/ucb/source/ucp/file/filrec.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrec.cxx,v $ - * $Revision: 1.3.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrec.hxx b/ucb/source/ucp/file/filrec.hxx index 4d6833159719..90168da2c9a5 100644 --- a/ucb/source/ucp/file/filrec.hxx +++ b/ucb/source/ucp/file/filrec.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrec.hxx,v $ - * $Revision: 1.3.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrow.cxx b/ucb/source/ucp/file/filrow.cxx index 62085b58ecc8..5b135358cf31 100644 --- a/ucb/source/ucp/file/filrow.cxx +++ b/ucb/source/ucp/file/filrow.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrow.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrow.hxx b/ucb/source/ucp/file/filrow.hxx index 18c50f48cf4a..bc8954da3510 100644 --- a/ucb/source/ucp/file/filrow.hxx +++ b/ucb/source/ucp/file/filrow.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrow.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index c8efb6bf37c7..5dcdd8445556 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrset.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filrset.hxx b/ucb/source/ucp/file/filrset.hxx index 7adb27245f66..977eddec8ccd 100644 --- a/ucb/source/ucp/file/filrset.hxx +++ b/ucb/source/ucp/file/filrset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filrset.hxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filstr.cxx b/ucb/source/ucp/file/filstr.cxx index 4ba4ff5c2b7e..2e45e22b790b 100644 --- a/ucb/source/ucp/file/filstr.cxx +++ b/ucb/source/ucp/file/filstr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filstr.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filstr.hxx b/ucb/source/ucp/file/filstr.hxx index 7d779bd4518a..b5ffae2a5ea2 100644 --- a/ucb/source/ucp/file/filstr.hxx +++ b/ucb/source/ucp/file/filstr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filstr.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx index 57c165b0b9b0..a1350bb4cfaf 100644 --- a/ucb/source/ucp/file/filtask.cxx +++ b/ucb/source/ucp/file/filtask.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtask.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,11 +30,11 @@ #include "filtask.hxx" #include "filglob.hxx" -/*********************************************************************************/ -/* */ -/* TaskHandling */ -/* */ -/*********************************************************************************/ +/******************************************************************************/ +/* */ +/* TaskHandling */ +/* */ +/******************************************************************************/ using namespace fileaccess; @@ -70,7 +67,9 @@ TaskManager::startTask( TaskMap::iterator it = m_aTaskMap.find( CommandId ); if( it != m_aTaskMap.end() ) { - throw DuplicateCommandIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + throw DuplicateCommandIdentifierException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), + uno::Reference< uno::XInterface >() ); } m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv ); } @@ -91,7 +90,8 @@ TaskManager::endTask( sal_Int32 CommandId, sal_Int32 MinorCode = it->second.getMinorErrorCode(); bool isHandled = it->second.isHandled(); - Reference< XCommandEnvironment > xComEnv = it->second.getCommandEnvironment(); + Reference< XCommandEnvironment > xComEnv + = it->second.getCommandEnvironment(); m_aTaskMap.erase( it ); @@ -122,17 +122,6 @@ TaskManager::abort( sal_Int32 CommandId ) } -bool SAL_CALL TaskManager::isAborted( sal_Int32 CommandId ) -{ - osl::MutexGuard aGuard( m_aMutex ); - TaskMap::iterator it = m_aTaskMap.find( CommandId ); - if( it == m_aTaskMap.end() || it->second.isAborted() ) - return false; - else - return true; -} - - void SAL_CALL TaskManager::clearError( sal_Int32 CommandId ) { osl::MutexGuard aGuard( m_aMutex ); @@ -178,45 +167,9 @@ TaskManager::getCommandId( void ) -uno::Reference< task::XInteractionHandler > SAL_CALL -TaskManager::getInteractionHandler( sal_Int32 CommandId ) -{ - osl::MutexGuard aGuard( m_aMutex ); - TaskMap::iterator it = m_aTaskMap.find( CommandId ); - if( it == m_aTaskMap.end() ) - return uno::Reference< task::XInteractionHandler >( 0 ); - else - return it->second.getInteractionHandler(); -} - - - -uno::Reference< XProgressHandler > SAL_CALL -TaskManager::getProgressHandler( sal_Int32 CommandId ) -{ - osl::MutexGuard aGuard( m_aMutex ); - TaskMap::iterator it = m_aTaskMap.find( CommandId ); - if( it == m_aTaskMap.end() ) - return uno::Reference< XProgressHandler >( 0 ); - else - return it->second.getProgressHandler(); -} - - -uno::Reference< XCommandEnvironment > SAL_CALL -TaskManager::getCommandEnvironment( sal_Int32 CommandId ) -{ - osl::MutexGuard aGuard( m_aMutex ); - TaskMap::iterator it = m_aTaskMap.find( CommandId ); - if( it == m_aTaskMap.end() ) - return uno::Reference< XCommandEnvironment >( 0 ); - else - return it->second.getCommandEnvironment(); -} - - -void SAL_CALL TaskManager::handleTask( sal_Int32 CommandId, - const uno::Reference< task::XInteractionRequest >& request ) +void SAL_CALL TaskManager::handleTask( + sal_Int32 CommandId, + const uno::Reference< task::XInteractionRequest >& request ) { osl::MutexGuard aGuard( m_aMutex ); TaskMap::iterator it = m_aTaskMap.find( CommandId ); @@ -229,8 +182,3 @@ void SAL_CALL TaskManager::handleTask( sal_Int32 CommandId, it->second.setHandled(); } } - - - - - diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx index a507ba1bee80..6ce4f35b4240 100644 --- a/ucb/source/ucp/file/filtask.hxx +++ b/ucb/source/ucp/file/filtask.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtask.hxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -40,9 +37,7 @@ #include <com/sun/star/ucb/XProgressHandler.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> -#ifndef _FILERROR_HXX_ #include "filerror.hxx" -#endif namespace fileaccess @@ -52,11 +47,8 @@ namespace fileaccess /* * This implementation is inherited by class fileaccess::shell. * The relevant methods in this class all have as first argument the CommandId, - * so if necessary, every method has acess to its relevant XInteractionHandler and - * XProgressHandler, simply by calling directly the method - * getInteractionHandler( CommandId ) - * and - * getProgressHandler(); + * so if necessary, every method has access to its relevant XInteractionHandler and + * XProgressHandler. */ @@ -95,11 +87,6 @@ namespace fileaccess m_bAbort = true; } - bool SAL_CALL isAborted() - { - return m_bAbort; - } - void setHandled() { m_bHandled = true; @@ -182,7 +169,6 @@ namespace fileaccess sal_Int32 SAL_CALL getCommandId( void ); void SAL_CALL abort( sal_Int32 CommandId ); - bool SAL_CALL isAborted( sal_Int32 CommandId ); /** @@ -234,16 +220,6 @@ namespace fileaccess void SAL_CALL clearError( sal_Int32 ); - - com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > SAL_CALL - getInteractionHandler( sal_Int32 CommandId ); - - com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > SAL_CALL - getProgressHandler( sal_Int32 CommandId ); - - com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > SAL_CALL - getCommandEnvironment( sal_Int32 CommandId ); - }; } // end namespace TaskHandling diff --git a/ucb/source/ucp/file/makefile.mk b/ucb/source/ucp/file/makefile.mk index d03983bca000..b11fdd8081dc 100644 --- a/ucb/source/ucp/file/makefile.mk +++ b/ucb/source/ucp/file/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 08da75ebdeb9..a456d2acbd32 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prov.cxx,v $ - * $Revision: 1.47 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx index e00646a68f86..52f0ba35f3cb 100644 --- a/ucb/source/ucp/file/prov.hxx +++ b/ucb/source/ucp/file/prov.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: prov.hxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index f53873563c99..769e58c08819 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shell.cxx,v $ - * $Revision: 1.98 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -46,23 +43,18 @@ #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/ucb/XContentIdentifier.hpp> #include <com/sun/star/lang/XComponent.hpp> -#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_ #include <com/sun/star/ucb/XContentAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> -#endif #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/ucb/OpenCommandArgument.hpp> #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp> #include <com/sun/star/ucb/TransferInfo.hpp> +#include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/beans/XPropertiesChangeListener.hpp> #include <rtl/string.hxx> -#ifndef _FILERROR_HXX_ #include "filerror.hxx" -#endif #include "filglob.hxx" #include "filcmd.hxx" #include "filinpstr.hxx" @@ -188,9 +180,10 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF IsHidden( rtl::OUString::createFromAscii( "IsHidden" ) ), ContentType( rtl::OUString::createFromAscii( "ContentType" ) ), IsReadOnly( rtl::OUString::createFromAscii( "IsReadOnly" ) ), + CreatableContentsInfo( rtl::OUString::createFromAscii( "CreatableContentsInfo" ) ), FolderContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-folder" ) ), FileContentType( rtl::OUString::createFromAscii( "application/vnd.sun.staroffice.fsys-file" ) ), - m_sCommandInfo( 8 ) + m_sCommandInfo( 9 ) { // Title m_aDefaultProperties.insert( MyProperty( true, @@ -294,7 +287,7 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF | beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) ); - // Remote + // Hidden m_aDefaultProperties.insert( MyProperty( true, @@ -312,7 +305,6 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF #endif - // ContentType uno::Any aAny; aAny <<= rtl::OUString(); @@ -358,6 +350,17 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF | beans::PropertyAttribute::BOUND ) ); + // CreatableContentsInfo + m_aDefaultProperties.insert( MyProperty( true, + CreatableContentsInfo, + -1 , + getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + uno::Any(), + beans::PropertyState_DEFAULT_VALUE, + beans::PropertyAttribute::MAYBEVOID + | beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) ); + // Commands m_sCommandInfo[0].Name = rtl::OUString::createFromAscii( "getCommandInfo" ); m_sCommandInfo[0].Handle = -1; @@ -391,6 +394,9 @@ shell::shell( const uno::Reference< lang::XMultiServiceFactory >& xMultiServiceF m_sCommandInfo[7].Handle = -1; m_sCommandInfo[7].ArgType = getCppuType( static_cast< InsertCommandArgument* > ( 0 ) ); + m_sCommandInfo[7].Name = rtl::OUString::createFromAscii( "createNewContent" ); + m_sCommandInfo[7].Handle = -1; + m_sCommandInfo[7].ArgType = getCppuType( static_cast< ucb::ContentInfo * > ( 0 ) ); if(m_bWithConfig) { @@ -1597,7 +1603,7 @@ shell::remove( sal_Int32 CommandId, nError = aDirectory.getNextItem( aItem ); while( nError == osl::FileBase::E_None ) { - nError = aItem.getFileStatus( aStatus ); + nError = aItem.getFileStatus( aStatus ); if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) ) { installError( CommandId, @@ -1623,7 +1629,7 @@ shell::remove( sal_Int32 CommandId, nError = aDirectory.getNextItem( aItem ); } - aDirectory.close(); + aDirectory.close(); if( ! whileSuccess ) return sal_False; // error code is installed @@ -2297,9 +2303,9 @@ shell::commit( const shell::ContentMap::iterator& it, sal_Bool isDirectory,isFile,isVolume,isRemoveable,isRemote,isFloppy,isCompactDisc; - sal_Int64 dirSize = 0;
-
- if( aFileStatus.isValid( FileStatusMask_FileSize ) )
+ sal_Int64 dirSize = 0; + + if( aFileStatus.isValid( FileStatusMask_FileSize ) ) dirSize = aFileStatus.getFileSize(); if( aFileStatus.isValid( FileStatusMask_Type ) ) @@ -2320,7 +2326,7 @@ shell::commit( const shell::ContentMap::iterator& it, isFile = osl::FileStatus::Regular == aFileStatus2.getFileType(); - if( aFileStatus2.isValid( FileStatusMask_FileSize ) )
+ if( aFileStatus2.isValid( FileStatusMask_FileSize ) ) dirSize = aFileStatus2.getFileSize(); } else @@ -2346,17 +2352,17 @@ shell::commit( const shell::ContentMap::iterator& it, osl::FileStatus::Regular == aFileStatus.getFileType(); } - aAny <<= isVolume; it1 = properties.find( MyProperty( IsVolume ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isVolume ) ); - aAny <<= isDirectory; it1 = properties.find( MyProperty( IsFolder ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isDirectory ) ); - aAny <<= isFile; it1 = properties.find( MyProperty( IsDocument ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isFile ) ); osl::VolumeInfo aVolumeInfo( VolumeInfoMask_Attributes ); if( isVolume && @@ -2369,44 +2375,51 @@ shell::commit( const shell::ContentMap::iterator& it, isCompactDisc = aVolumeInfo.getCompactDiscFlag(); isFloppy = aVolumeInfo.getFloppyDiskFlag(); - aAny <<= isRemote; it1 = properties.find( MyProperty( IsRemote ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isRemote ) ); - aAny <<= isRemoveable; it1 = properties.find( MyProperty( IsRemoveable ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isRemoveable ) ); - aAny <<= isCompactDisc; it1 = properties.find( MyProperty( IsCompactDisc ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isCompactDisc ) ); - aAny <<= isFloppy; it1 = properties.find( MyProperty( IsFloppy ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( isFloppy ) ); } else { sal_Bool dummy = false; aAny <<= dummy; it1 = properties.find( MyProperty( IsRemote ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( aAny ); + it1 = properties.find( MyProperty( IsRemoveable ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( aAny ); + it1 = properties.find( MyProperty( IsCompactDisc ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( aAny ); + it1 = properties.find( MyProperty( IsFloppy ) ); - if( it1 != properties.end() ) it1->setValue( aAny ); + if( it1 != properties.end() ) + it1->setValue( aAny ); } } - - it1 = properties.find( MyProperty( Size ) ); - if( it1 != properties.end() ) + else { - aAny <<= dirSize;
- it1->setValue( aAny ); + isDirectory = sal_False; } + it1 = properties.find( MyProperty( Size ) ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( dirSize ) ); it1 = properties.find( MyProperty( IsReadOnly ) ); if( it1 != properties.end() ) @@ -2415,8 +2428,7 @@ shell::commit( const shell::ContentMap::iterator& it, { sal_uInt64 Attr = aFileStatus.getAttributes(); sal_Bool readonly = ( Attr & Attribute_ReadOnly ) != 0; - aAny <<= readonly; - it1->setValue( aAny ); + it1->setValue( uno::makeAny( readonly ) ); } } @@ -2427,13 +2439,11 @@ shell::commit( const shell::ContentMap::iterator& it, { sal_uInt64 Attr = aFileStatus.getAttributes(); sal_Bool ishidden = ( Attr & Attribute_Hidden ) != 0; - aAny <<= ishidden; - it1->setValue( aAny ); + it1->setValue( uno::makeAny( ishidden ) ); } } it1 = properties.find( MyProperty( DateModified ) ); - if( it1 != properties.end() ) { if( aFileStatus.isValid( FileStatusMask_ModifyTime ) ) @@ -2441,7 +2451,7 @@ shell::commit( const shell::ContentMap::iterator& it, TimeValue temp = aFileStatus.getModifyTime(); // Convert system time to local time (for EA) - TimeValue myLocalTime; + TimeValue myLocalTime; osl_getLocalTimeFromSystemTime( &temp, &myLocalTime ); oslDateTime myDateTime; @@ -2455,11 +2465,16 @@ shell::commit( const shell::ContentMap::iterator& it, aDateTime.Day = myDateTime.Day; aDateTime.Month = myDateTime.Month; aDateTime.Year = myDateTime.Year; - aAny <<= aDateTime; - it1->setValue( aAny ); + it1->setValue( uno::makeAny( aDateTime ) ); } } + it1 = properties.find( MyProperty( CreatableContentsInfo ) ); + if( it1 != properties.end() ) + it1->setValue( uno::makeAny( + isDirectory || !aFileStatus.isValid( FileStatusMask_Type ) + ? queryCreatableContentsInfo() + : uno::Sequence< ucb::ContentInfo >() ) ); } @@ -2494,8 +2509,8 @@ shell::getv( { // Assume failure aIsRegular = false; - osl::FileBase::RC result = osl::FileBase::E_INVAL; - osl::DirectoryItem aTargetItem; + osl::FileBase::RC result = osl::FileBase::E_INVAL; + osl::DirectoryItem aTargetItem; osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem ); if ( aTargetItem.is() ) { @@ -3000,6 +3015,31 @@ shell::copyPersistentSet( const rtl::OUString& srcUnqPath, } // end for( sal_Int... } +uno::Sequence< ucb::ContentInfo > shell::queryCreatableContentsInfo() +{ + uno::Sequence< ucb::ContentInfo > seq(2); + + // file + seq[0].Type = FileContentType; + seq[0].Attributes = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM + | ucb::ContentInfoAttribute::KIND_DOCUMENT; + + uno::Sequence< beans::Property > props( 1 ); + props[0] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< rtl::OUString* >( 0 ) ), + beans::PropertyAttribute::MAYBEVOID + | beans::PropertyAttribute::BOUND ); + seq[0].Properties = props; + + // folder + seq[1].Type = FolderContentType; + seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; + seq[1].Properties = props; + return seq; +} + /*******************************************************************************/ /* */ /* some misceancellous static functions */ diff --git a/ucb/source/ucp/file/shell.hxx b/ucb/source/ucp/file/shell.hxx index 811cdce531b0..14e332959a26 100644 --- a/ucb/source/ucp/file/shell.hxx +++ b/ucb/source/ucp/file/shell.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shell.hxx,v $ - * $Revision: 1.26 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -54,21 +51,18 @@ #include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XInputStream.hpp> -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_protected #include <com/sun/star/beans/XPropertySetInfo.hpp> -#endif #include <com/sun/star/beans/XPropertiesChangeNotifier.hpp> #include <com/sun/star/ucb/NumberedSortingInfo.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ucb/XContentProvider.hpp> -#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP__ #include <com/sun/star/ucb/XDynamicResultSet.hpp> -#endif #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> #include <com/sun/star/ucb/XPropertySetRegistryFactory.hpp> #include <com/sun/star/ucb/TransferInfo.hpp> +#include <com/sun/star/ucb/ContentInfo.hpp> #include "filtask.hxx" #include "filnot.hxx" @@ -307,7 +301,7 @@ namespace fileaccess { /********************************************************************************/ - /* transfer-commandos */ + /* transfer-commands */ /********************************************************************************/ /** @@ -398,6 +392,9 @@ namespace fileaccess { void SAL_CALL insertDefaultProperties( const rtl::OUString& aUnqPath ); + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + queryCreatableContentsInfo(); + /******************************************************************************/ /* */ @@ -416,7 +413,6 @@ namespace fileaccess { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMultiServiceFactory; com::sun::star::uno::Reference< com::sun::star::ucb::XPropertySetRegistry > m_xFileRegistry; - private: /********************************************************************************/ @@ -580,6 +576,7 @@ namespace fileaccess { const rtl::OUString IsHidden; const rtl::OUString ContentType; const rtl::OUString IsReadOnly; + const rtl::OUString CreatableContentsInfo; public: diff --git a/ucb/source/ucp/ftp/curl.hxx b/ucb/source/ucp/ftp/curl.hxx index 4a251ff79f3e..70ace6e9fd76 100644 --- a/ucb/source/ucp/ftp/curl.hxx +++ b/ucb/source/ucp/ftp/curl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: curl.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcfunc.cxx b/ucb/source/ucp/ftp/ftpcfunc.cxx index fef6cc505eb5..24eafec542dd 100644 --- a/ucb/source/ucp/ftp/ftpcfunc.cxx +++ b/ucb/source/ucp/ftp/ftpcfunc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcfunc.cxx,v $ - * $Revision: 1.7.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcfunc.hxx b/ucb/source/ucp/ftp/ftpcfunc.hxx index 8c2d79d93238..3b0f63dd8a8d 100644 --- a/ucb/source/ucp/ftp/ftpcfunc.hxx +++ b/ucb/source/ucp/ftp/ftpcfunc.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcfunc.hxx,v $ - * $Revision: 1.6.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcontainer.hxx b/ucb/source/ucp/ftp/ftpcontainer.hxx index 99dd90bcfcd7..6c57bdf1e43f 100644 --- a/ucb/source/ucp/ftp/ftpcontainer.hxx +++ b/ucb/source/ucp/ftp/ftpcontainer.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontainer.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index e4533d872275..4659197b81b5 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontent.cxx,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -106,19 +103,6 @@ using namespace com::sun::star::sdbc; FTPContent::FTPContent( const Reference< XMultiServiceFactory >& rxSMgr, FTPContentProvider* pProvider, - const Reference< XContentIdentifier >& Identifier) - : ContentImplHelper(rxSMgr,pProvider,Identifier), - m_pFCP(pProvider), - m_aFTPURL(Identifier->getContentIdentifier(), - pProvider), - m_bInserted(false), - m_bTitleSet(false) -{ -} - - -FTPContent::FTPContent( const Reference< XMultiServiceFactory >& rxSMgr, - FTPContentProvider* pProvider, const Reference< XContentIdentifier >& Identifier, const FTPURL& aFTPURL) : ContentImplHelper(rxSMgr,pProvider,Identifier), @@ -175,9 +159,9 @@ XINTERFACE_IMPL_6( FTPContent, //========================================================================= XTYPEPROVIDER_IMPL_6( FTPContent, - XTypeProvider, - XServiceInfo, - XContent, + XTypeProvider, + XServiceInfo, + XContent, XCommandProcessor, XContentCreator, XChild); @@ -231,7 +215,7 @@ void SAL_CALL FTPContent::abort( sal_Int32 /*CommandId*/ ) /***************************************************************************/ /* */ -/* Interne Implklasse */ +/* Internal implementation class. */ /* */ /***************************************************************************/ @@ -376,66 +360,85 @@ Any SAL_CALL FTPContent::execute( // return aRet; // } - if(action == THROWAUTHENTICATIONREQUEST) { + switch (action) + { + case NOACTION: + break; + + case THROWAUTHENTICATIONREQUEST: ucbhelper::cancelCommandExecution( aRet, Reference<XCommandEnvironment>(0)); - } else if(action == THROWACCESSDENIED) { - Sequence<Any> seq(1); - PropertyValue value; - value.Name = - rtl::OUString::createFromAscii("Uri"); - value.Handle = -1; - value.Value <<= m_aFTPURL.ident(false,false); - value.State = PropertyState_DIRECT_VALUE; - seq[0] <<= value; - ucbhelper::cancelCommandExecution( - IOErrorCode_ACCESS_DENIED, - seq, - Environment); - } else if(action == THROWINTERACTIVECONNECT) { - InteractiveNetworkConnectException - excep; - excep.Server = m_aFTPURL.host(); - aRet <<= excep; - ucbhelper::cancelCommandExecution( - aRet, - Environment); - } else if(action == THROWRESOLVENAME) { - InteractiveNetworkResolveNameException - excep; - excep.Server = m_aFTPURL.host(); - aRet <<= excep; - ucbhelper::cancelCommandExecution( - aRet, - Environment); - } else if(action == THROWNOFILE) { - Sequence<Any> seq(1); - PropertyValue value; - value.Name = - rtl::OUString::createFromAscii("Uri"); - value.Handle = -1; - value.Value <<= m_aFTPURL.ident(false,false); - value.State = PropertyState_DIRECT_VALUE; - seq[0] <<= value; - ucbhelper::cancelCommandExecution( - IOErrorCode_NO_FILE, - seq, - Environment); - } else if(action == THROWQUOTE || - action == THROWGENERAL) { + break; + + case THROWACCESSDENIED: + { + Sequence<Any> seq(1); + PropertyValue value; + value.Name = rtl::OUString::createFromAscii("Uri"); + value.Handle = -1; + value.Value <<= m_aFTPURL.ident(false,false); + value.State = PropertyState_DIRECT_VALUE; + seq[0] <<= value; + ucbhelper::cancelCommandExecution( + IOErrorCode_ACCESS_DENIED, + seq, + Environment); + break; + } + case THROWINTERACTIVECONNECT: + { + InteractiveNetworkConnectException excep; + excep.Server = m_aFTPURL.host(); + aRet <<= excep; + ucbhelper::cancelCommandExecution( + aRet, + Environment); + break; + } + case THROWRESOLVENAME: + { + InteractiveNetworkResolveNameException excep; + excep.Server = m_aFTPURL.host(); + aRet <<= excep; + ucbhelper::cancelCommandExecution( + aRet, + Environment); + break; + } + case THROWNOFILE: + { + Sequence<Any> seq(1); + PropertyValue value; + value.Name = rtl::OUString::createFromAscii("Uri"); + value.Handle = -1; + value.Value <<= m_aFTPURL.ident(false,false); + value.State = PropertyState_DIRECT_VALUE; + seq[0] <<= value; + ucbhelper::cancelCommandExecution( + IOErrorCode_NO_FILE, + seq, + Environment); + break; + } + case THROWQUOTE: + case THROWGENERAL: ucbhelper::cancelCommandExecution( IOErrorCode_GENERAL, Sequence<Any>(0), Environment); + break; } - if(aCommand.Name.compareToAscii("getPropertyValues") == 0) { Sequence<Property> Properties; if(!(aCommand.Argument >>= Properties)) { - aRet <<= IllegalArgumentException(); + aRet <<= IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >(this), + -1); ucbhelper::cancelCommandExecution(aRet,Environment); } @@ -446,7 +449,11 @@ Any SAL_CALL FTPContent::execute( Sequence<PropertyValue> propertyValues; if( ! ( aCommand.Argument >>= propertyValues ) ) { - aRet <<= IllegalArgumentException(); + aRet <<= IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >(this), + -1); ucbhelper::cancelCommandExecution(aRet,Environment); } @@ -464,7 +471,11 @@ Any SAL_CALL FTPContent::execute( { InsertCommandArgument aInsertArgument; if ( ! ( aCommand.Argument >>= aInsertArgument ) ) { - aRet <<= IllegalArgumentException(); + aRet <<= IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >(this), + -1); ucbhelper::cancelCommandExecution(aRet,Environment); } insert(aInsertArgument,Environment); @@ -476,7 +487,12 @@ Any SAL_CALL FTPContent::execute( else if(aCommand.Name.compareToAscii( "open" ) == 0) { OpenCommandArgument2 aOpenCommand; if ( !( aCommand.Argument >>= aOpenCommand ) ) { - aRet <<= IllegalArgumentException(); + aRet <<= IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >(this), + -1); + ucbhelper::cancelCommandExecution(aRet,Environment); } @@ -529,7 +545,10 @@ Any SAL_CALL FTPContent::execute( } } else { - aRet <<= UnsupportedDataSinkException(); + aRet <<= UnsupportedDataSinkException( + rtl::OUString(), + static_cast< cppu::OWeakObject * >(this), + aOpenCommand.Sink); ucbhelper::cancelCommandExecution(aRet,Environment); } } @@ -557,17 +576,39 @@ Any SAL_CALL FTPContent::execute( aOpenCommand.Mode == OpenMode::DOCUMENT_SHARE_DENY_WRITE) { // Unsupported OpenMode - aRet <<= UnsupportedOpenModeException(); + aRet <<= UnsupportedOpenModeException( + rtl::OUString(), + static_cast< cppu::OWeakObject * >(this), + static_cast< sal_Int16 >(aOpenCommand.Mode)); ucbhelper::cancelCommandExecution(aRet,Environment); } else { - // IllegalArgumentException:: No OpenMode - aRet <<= IllegalArgumentException(); + aRet <<= IllegalArgumentException( + rtl::OUString::createFromAscii( + "Unexpected OpenMode!" ), + static_cast< cppu::OWeakObject * >(this), + -1); + ucbhelper::cancelCommandExecution(aRet,Environment); } - } - else { - aRet <<= UnsupportedCommandException(); + } else if(aCommand.Name.compareToAscii("createNewContent") == 0) { + ContentInfo aArg; + if (!(aCommand.Argument >>= aArg)) { + ucbhelper::cancelCommandExecution( + makeAny( + IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >(this), + -1)), + Environment); + // Unreachable + } + aRet <<= createNewContent(aArg); + } else { + aRet <<= UnsupportedCommandException( + aCommand.Name, + static_cast< cppu::OWeakObject * >(this)); ucbhelper::cancelCommandExecution(aRet,Environment); } @@ -578,8 +619,9 @@ Any SAL_CALL FTPContent::execute( else if(e.code() == CURLE_COULDNT_RESOLVE_HOST ) action = THROWRESOLVENAME; else if(e.code() == CURLE_FTP_USER_PASSWORD_INCORRECT || + e.code() == CURLE_LOGIN_DENIED || e.code() == CURLE_BAD_PASSWORD_ENTERED || - e.code() == CURLE_FTP_WEIRD_PASS_REPLY ) + e.code() == CURLE_FTP_WEIRD_PASS_REPLY) action = THROWAUTHENTICATIONREQUEST; else if(e.code() == CURLE_FTP_ACCESS_DENIED) action = THROWACCESSDENIED; @@ -588,7 +630,7 @@ Any SAL_CALL FTPContent::execute( else if(e.code() == CURLE_FTP_COULDNT_RETR_FILE) action = THROWNOFILE; else - // nothing known about the course of the error + // nothing known about the cause of the error action = THROWGENERAL; } } @@ -605,6 +647,14 @@ Sequence<ContentInfo > SAL_CALL FTPContent::queryCreatableContentsInfo( ) throw (RuntimeException) { + return queryCreatableContentsInfo_Static(); +} + +// static +Sequence<ContentInfo > +FTPContent::queryCreatableContentsInfo_Static( ) + throw (RuntimeException) +{ Sequence< ContentInfo > seq(2); seq[0].Type = FTP_FILE; @@ -627,7 +677,6 @@ FTPContent::queryCreatableContentsInfo( ) return seq; } - Reference<XContent > SAL_CALL FTPContent::createNewContent( const ContentInfo& Info ) throw (RuntimeException) @@ -697,7 +746,7 @@ sal_Int32 InsertData::read(sal_Int8 *dest,sal_Int32 nBytesRequested) sal_Int32 m = 0; if(m_xInputStream.is()) { - Sequence<sal_Int8> seq(nBytesRequested); + Sequence<sal_Int8> seq(nBytesRequested); m = m_xInputStream->readBytes(seq,nBytesRequested); rtl_copyMemory(dest,seq.getConstArray(),m); } @@ -798,6 +847,9 @@ Reference< XRow > FTPContent::getPropertyValues( const rtl::OUString& Name = seqProp[i].Name; if(Name.compareToAscii("Title") == 0) xRow->appendString(seqProp[i],aDirEntry.m_aName); + else if(Name.compareToAscii("CreatableContentsInfo") == 0) + xRow->appendObject(seqProp[i], + makeAny(queryCreatableContentsInfo())); else if(aDirEntry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) { if(Name.compareToAscii("ContentType") == 0) xRow->appendString(seqProp[i], @@ -838,9 +890,6 @@ Reference< XRow > FTPContent::getPropertyValues( Sequence<Any> FTPContent::setPropertyValues( const Sequence<PropertyValue>& seqPropVal) { - Sequence<Property> props = - getProperties(Reference<XCommandEnvironment>(0)); - Sequence<Any> ret(seqPropVal.getLength()); Sequence<PropertyChangeEvent > evt; @@ -879,11 +928,20 @@ Sequence<Any> FTPContent::setPropertyValues( ret[i] <<= excep; } } else { - // either not unknown or illegal + Sequence<Property> props = + getProperties(Reference<XCommandEnvironment>(0)); + + // either unknown or read-only ret[i] <<= UnknownPropertyException(); for(sal_Int32 j = 0; j < props.getLength(); ++j) if(props[j].Name == seqPropVal[i].Name) { - ret[i] <<= IllegalAccessException(); + ret[i] <<= IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!"), + //props[j].Attributes & PropertyAttribute::READONLY + // ? "Property is read-only!" + // : "Access denied!"), + static_cast< cppu::OWeakObject * >( this )); break; } } diff --git a/ucb/source/ucp/ftp/ftpcontent.hxx b/ucb/source/ucp/ftp/ftpcontent.hxx index 3d243cff84dd..234810bd1eb9 100644 --- a/ucb/source/ucp/ftp/ftpcontent.hxx +++ b/ucb/source/ucp/ftp/ftpcontent.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontent.hxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -57,19 +54,6 @@ namespace ftp //========================================================================= - struct ContentProperties - { - ::rtl::OUString aTitle; // Title - ::rtl::OUString aContentType; // ContentType - sal_Bool bIsDocument; // IsDocument - sal_Bool bIsFolder; // IsFolder - - ContentProperties() - : bIsDocument( sal_True ), bIsFolder( sal_False ) {} - }; - -//========================================================================= - class FTPContentProvider; //========================================================================= @@ -84,12 +68,6 @@ namespace ftp ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, FTPContentProvider* pProvider, const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XContentIdentifier >& Identifier); - - FTPContent( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - FTPContentProvider* pProvider, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier, const FTPURL& FtpUrl); @@ -156,6 +134,11 @@ namespace ftp ::com::sun::star::uno::RuntimeException); + static com::sun::star::uno::Sequence< + com::sun::star::ucb::ContentInfo > + queryCreatableContentsInfo_Static( ) + throw (com::sun::star::uno::RuntimeException); + private: FTPContentProvider *m_pFCP; diff --git a/ucb/source/ucp/ftp/ftpcontentcaps.cxx b/ucb/source/ucp/ftp/ftpcontentcaps.cxx index 59fa976ff656..421d44401f6d 100644 --- a/ucb/source/ucp/ftp/ftpcontentcaps.cxx +++ b/ucb/source/ucp/ftp/ftpcontentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontentcaps.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,7 +46,7 @@ using namespace ftp; uno::Sequence< beans::Property > FTPContent::getProperties( const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/) { - #define PROPS_COUNT 7 + #define PROPS_COUNT 8 static const beans::Property aPropsInfoTable[] = { @@ -91,7 +88,7 @@ uno::Sequence< beans::Property > FTPContent::getProperties( beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" ) ), -1, - getCppuType( static_cast< util::DateTime* >( 0 ) ), + getCppuType( static_cast< util::DateTime * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), @@ -101,10 +98,19 @@ uno::Sequence< beans::Property > FTPContent::getProperties( getCppuBooleanType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( + static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) }; - return uno::Sequence< beans::Property >( aPropsInfoTable,PROPS_COUNT); + return uno::Sequence< beans::Property >( aPropsInfoTable, PROPS_COUNT ); } //========================================================================= @@ -112,7 +118,7 @@ uno::Sequence< beans::Property > FTPContent::getProperties( uno::Sequence< ucb::CommandInfo > FTPContent::getCommands( const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ ) { -// osl::MutexGuard aGuard( m_aMutex ); +// osl::MutexGuard aGuard( m_aMutex ); //================================================================= // @@ -120,7 +126,7 @@ uno::Sequence< ucb::CommandInfo > FTPContent::getCommands( // //================================================================= - #define COMMAND_COUNT 7 + #define COMMAND_COUNT 8 static const ucb::CommandInfo aCommandInfoTable[] = { @@ -167,10 +173,15 @@ uno::Sequence< ucb::CommandInfo > FTPContent::getCommands( ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ), -1, - getCppuType( static_cast< sal_Bool * >( 0 ) ) + getCppuBooleanType() + ), + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ) }; - return uno::Sequence<ucb::CommandInfo>(aCommandInfoTable,COMMAND_COUNT); + return uno::Sequence< ucb::CommandInfo >( aCommandInfoTable, COMMAND_COUNT ); } diff --git a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx index a1c8fd6bb321..0d65c06a9281 100644 --- a/ucb/source/ucp/ftp/ftpcontentidentifier.cxx +++ b/ucb/source/ucp/ftp/ftpcontentidentifier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontentidentifier.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcontentidentifier.hxx b/ucb/source/ucp/ftp/ftpcontentidentifier.hxx index 0f4985728001..7827fc7148eb 100644 --- a/ucb/source/ucp/ftp/ftpcontentidentifier.hxx +++ b/ucb/source/ucp/ftp/ftpcontentidentifier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontentidentifier.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx index 32750a1b6ed3..2cfc62afe440 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontentprovider.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.hxx b/ucb/source/ucp/ftp/ftpcontentprovider.hxx index 33754dd1f3e9..30b74a5f44c8 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.hxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpcontentprovider.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx index 2b281e73319d..10f6fa88a6c0 100644 --- a/ucb/source/ucp/ftp/ftpdirp.cxx +++ b/ucb/source/ucp/ftp/ftpdirp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpdirp.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -974,18 +971,6 @@ sal_Bool FTPDirectoryParser::parseUNIX ( } /* - * parseUNKNOWN. - */ -sal_Bool FTPDirectoryParser::parseUNKNOWN ( - FTPDirentry &rEntry, - const sal_Char *pBuffer, - sal_uInt32 nLength) -{ - setPath (rEntry.m_aName, pBuffer,sal_Int32 (nLength)); - return sal_True; -} - -/* * parseUNIX_isSizeField. */ sal_Bool FTPDirectoryParser::parseUNIX_isSizeField ( diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx index 4a57ee841cba..aeb265dbf286 100644 --- a/ucb/source/ucp/ftp/ftpdirp.hxx +++ b/ucb/source/ucp/ftp/ftpdirp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpdirp.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -146,11 +143,6 @@ namespace ftp { FTPDirentry &rEntry, const sal_Char *pBuffer ); - static sal_Bool parseUNKNOWN ( - FTPDirentry &rEntry, - const sal_Char *pBuffer, - sal_uInt32 nLength); - private: diff --git a/ucb/source/ucp/ftp/ftpdynresultset.cxx b/ucb/source/ucp/ftp/ftpdynresultset.cxx index 53651e6a9de9..93f274f1ac5f 100644 --- a/ucb/source/ucp/ftp/ftpdynresultset.cxx +++ b/ucb/source/ucp/ftp/ftpdynresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpdynresultset.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpdynresultset.hxx b/ucb/source/ucp/ftp/ftpdynresultset.hxx index 39f2e8dbc048..b1e92c15750a 100644 --- a/ucb/source/ucp/ftp/ftpdynresultset.hxx +++ b/ucb/source/ucp/ftp/ftpdynresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpdynresultset.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpinpstr.cxx b/ucb/source/ucp/ftp/ftpinpstr.cxx index 91b283271eb3..5fe5c829f976 100644 --- a/ucb/source/ucp/ftp/ftpinpstr.cxx +++ b/ucb/source/ucp/ftp/ftpinpstr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpinpstr.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -56,8 +53,8 @@ FTPInputStream::FTPInputStream(FILE* tmpfl) : m_tmpfl(tmpfl ? tmpfl : tmpfile()) { fseek(m_tmpfl,0,SEEK_END); -// fpos_t pos; -// fgetpos(m_tmpfl,&pos); +// fpos_t pos; +// fgetpos(m_tmpfl,&pos); long pos = ftell(m_tmpfl); rewind(m_tmpfl); m_nLength = sal_Int64(pos); @@ -119,14 +116,17 @@ sal_Int32 SAL_CALL FTPInputStream::readBytes(Sequence< sal_Int8 >& aData, long bpos,epos; bpos = ftell(m_tmpfl); - fread(aData.getArray(),nBytesToRead,1,m_tmpfl); + if (fread(aData.getArray(),nBytesToRead,1,m_tmpfl) != 1) + throw IOException(); + epos = ftell(m_tmpfl); return sal_Int32(epos-bpos); } -sal_Int32 SAL_CALL FTPInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead ) +sal_Int32 SAL_CALL FTPInputStream::readSomeBytes( Sequence< sal_Int8 >& aData, + sal_Int32 nMaxBytesToRead ) throw( NotConnectedException, BufferSizeExceededException, IOException, diff --git a/ucb/source/ucp/ftp/ftpinpstr.hxx b/ucb/source/ucp/ftp/ftpinpstr.hxx index 7b5f80a334f7..0d235be36e35 100644 --- a/ucb/source/ucp/ftp/ftpinpstr.hxx +++ b/ucb/source/ucp/ftp/ftpinpstr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpinpstr.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpintreq.cxx b/ucb/source/ucp/ftp/ftpintreq.cxx index 1844036cba9d..2ee076d1e246 100644 --- a/ucb/source/ucp/ftp/ftpintreq.cxx +++ b/ucb/source/ucp/ftp/ftpintreq.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpintreq.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -101,7 +98,6 @@ bool XInteractionApproveImpl::isSelected() const } - // XInteractionDisapproveImpl XInteractionDisapproveImpl::XInteractionDisapproveImpl() @@ -156,13 +152,6 @@ void SAL_CALL XInteractionDisapproveImpl::select() } -bool XInteractionDisapproveImpl::isSelected() const -{ - return m_bSelected; -} - - - // XInteractionRequestImpl XInteractionRequestImpl::XInteractionRequestImpl(const rtl::OUString& aName) @@ -234,12 +223,6 @@ XInteractionRequestImpl::getContinuations( ) } -bool XInteractionRequestImpl::aborted() const -{ - return p2->isSelected(); -} - - bool XInteractionRequestImpl::approved() const { return p1->isSelected(); diff --git a/ucb/source/ucp/ftp/ftpintreq.hxx b/ucb/source/ucp/ftp/ftpintreq.hxx index 3b26b2c57162..1a772dc356e1 100644 --- a/ucb/source/ucp/ftp/ftpintreq.hxx +++ b/ucb/source/ucp/ftp/ftpintreq.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpintreq.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -118,8 +115,6 @@ namespace ftp { virtual void SAL_CALL select() throw (com::sun::star::uno::RuntimeException); - bool isSelected() const; - private: bool m_bSelected; @@ -166,8 +161,6 @@ namespace ftp { getContinuations( ) throw (com::sun::star::uno::RuntimeException); - bool aborted() const; - bool approved() const; private: diff --git a/ucb/source/ucp/ftp/ftploaderthread.cxx b/ucb/source/ucp/ftp/ftploaderthread.cxx index 1ead94132698..727d056f7fe8 100644 --- a/ucb/source/ucp/ftp/ftploaderthread.cxx +++ b/ucb/source/ucp/ftp/ftploaderthread.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftploaderthread.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftploaderthread.hxx b/ucb/source/ucp/ftp/ftploaderthread.hxx index f98e0a84c8ac..1b91a0885048 100644 --- a/ucb/source/ucp/ftp/ftploaderthread.hxx +++ b/ucb/source/ucp/ftp/ftploaderthread.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftploaderthread.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpresultsetI.cxx b/ucb/source/ucp/ftp/ftpresultsetI.cxx index ab18061de31a..49976755f60c 100644 --- a/ucb/source/ucp/ftp/ftpresultsetI.cxx +++ b/ucb/source/ucp/ftp/ftpresultsetI.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpresultsetI.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -38,7 +35,7 @@ #include "com/sun/star/ucb/XCommandProcessor.hpp" #include "com/sun/star/sdbc/XRow.hpp" #include "ftpresultsetI.hxx" - +#include "ftpcontent.hxx" using namespace std; @@ -96,6 +93,10 @@ ResultSetI::ResultSetI(const Reference<XMultiServiceFactory>& xMSF, else if(Name.compareToAscii("DateCreated") == 0) xRow->appendTimestamp(seqProp[i], dirvec[n].m_aDate); + else if(Name.compareToAscii("CreatableContentsInfo") == 0) + xRow->appendObject( + seqProp[i], + makeAny(FTPContent::queryCreatableContentsInfo_Static())); else xRow->appendVoid(seqProp[i]); } diff --git a/ucb/source/ucp/ftp/ftpresultsetI.hxx b/ucb/source/ucp/ftp/ftpresultsetI.hxx index 4eb6c54a2ca9..ded6613abdcc 100644 --- a/ucb/source/ucp/ftp/ftpresultsetI.hxx +++ b/ucb/source/ucp/ftp/ftpresultsetI.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpresultsetI.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx index 631cbede8d26..c83a34e251e8 100644 --- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx +++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpresultsetbase.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.hxx b/ucb/source/ucp/ftp/ftpresultsetbase.hxx index 9201f5b05d3c..d82e38c14e03 100644 --- a/ucb/source/ucp/ftp/ftpresultsetbase.hxx +++ b/ucb/source/ucp/ftp/ftpresultsetbase.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpresultsetbase.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpresultsetfactory.hxx b/ucb/source/ucp/ftp/ftpresultsetfactory.hxx index d0ad445c7c81..24f14162e87e 100644 --- a/ucb/source/ucp/ftp/ftpresultsetfactory.hxx +++ b/ucb/source/ucp/ftp/ftpresultsetfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpresultsetfactory.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpservices.cxx b/ucb/source/ucp/ftp/ftpservices.cxx index e62394e0fc60..fb62acd1cbc0 100644 --- a/ucb/source/ucp/ftp/ftpservices.cxx +++ b/ucb/source/ucp/ftp/ftpservices.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpservices.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpstrcont.hxx b/ucb/source/ucp/ftp/ftpstrcont.hxx index 4f0007705242..8598be8831ae 100644 --- a/ucb/source/ucp/ftp/ftpstrcont.hxx +++ b/ucb/source/ucp/ftp/ftpstrcont.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpstrcont.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index 420b3f993f4f..c703e0942e8a 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpurl.cxx,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -163,19 +160,18 @@ void FTPURL::parse(const rtl::OUString& url) rtl::OString aIdent(url.getStr(), url.getLength(), RTL_TEXTENCODING_UTF8); - char *buffer = new char[1+aIdent.getLength()]; - - const char* p2 = aIdent.getStr(); rtl::OString lower = aIdent.toAsciiLowerCase(); if(lower.getLength() < 6 || strncmp("ftp://",lower.getStr(),6)) throw malformed_exception(); + char *buffer = new char[1+aIdent.getLength()]; + const char* p2 = aIdent.getStr(); p2 += 6; char ch; - char *p1 = buffer; // determine "username:password@host:port" + char *p1 = buffer; // determine "username:password@host:port" while((ch = *p2++) != '/' && ch) *p1++ = ch; *p1 = 0; @@ -393,7 +389,7 @@ namespace ftp { #define SET_DATA_CONTAINER \ - curl_easy_setopt(curl,CURLOPT_NOBODY,false); \ + curl_easy_setopt(curl,CURLOPT_NOBODY,false); \ MemoryContainer data; \ curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,memory_write); \ curl_easy_setopt(curl,CURLOPT_WRITEDATA,&data) @@ -590,6 +586,12 @@ rtl::OUString FTPURL::net_title() const // the client should retry after getting the correct // username + password throw curl_exception(err); +#if LIBCURL_VERSION_NUM>=0x070d01 /* 7.13.1 */ + else if(err == CURLE_LOGIN_DENIED) + // the client should retry after getting the correct + // username + password + throw curl_exception(err); +#endif else if(try_more && err == CURLE_FTP_ACCESS_DENIED) { // We were either denied access when trying to login to // an FTP server or when trying to change working directory @@ -665,8 +667,8 @@ void FTPURL::insert(bool replaceExisting,void* stream) const throw(curl_exception) { if(!replaceExisting) { -// FTPDirentry aDirentry(direntry()); -// if(aDirentry.m_nMode == INETCOREFTP_FILEMODE_UNKNOWN) +// FTPDirentry aDirentry(direntry()); +// if(aDirentry.m_nMode == INETCOREFTP_FILEMODE_UNKNOWN) // throw curl_exception(FILE_EXIST_DURING_INSERT); throw curl_exception(FILE_MIGHT_EXIST_DURING_INSERT); } // else @@ -716,8 +718,8 @@ void FTPURL::mkdir(bool ReplaceExisting) const FTPDirentry aDirentry(direntry()); if(!ReplaceExisting) { -// if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) -// throw curl_exception(FOLDER_EXIST_DURING_INSERT); +// if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) +// throw curl_exception(FOLDER_EXIST_DURING_INSERT); throw curl_exception(FOLDER_MIGHT_EXIST_DURING_INSERT); } else if(aDirentry.m_nMode != INETCOREFTP_FILEMODE_UNKNOWN) slist = curl_slist_append(slist,aDel.getStr()); diff --git a/ucb/source/ucp/ftp/ftpurl.hxx b/ucb/source/ucp/ftp/ftpurl.hxx index 33e2c268b209..fa2acdcc2770 100644 --- a/ucb/source/ucp/ftp/ftpurl.hxx +++ b/ucb/source/ucp/ftp/ftpurl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ftpurl.hxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/makefile.mk b/ucb/source/ucp/ftp/makefile.mk index 75f5512c728c..d9b674b78604 100644 --- a/ucb/source/ucp/ftp/makefile.mk +++ b/ucb/source/ucp/ftp/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.19 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test.cxx b/ucb/source/ucp/ftp/test.cxx index c3d604b8ce8f..9bc6585400ba 100644 --- a/ucb/source/ucp/ftp/test.cxx +++ b/ucb/source/ucp/ftp/test.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_activedatasink.cxx b/ucb/source/ucp/ftp/test_activedatasink.cxx index 752bd106839c..5265dc530be9 100644 --- a/ucb/source/ucp/ftp/test_activedatasink.cxx +++ b/ucb/source/ucp/ftp/test_activedatasink.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_activedatasink.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_activedatasink.hxx b/ucb/source/ucp/ftp/test_activedatasink.hxx index 7fd75da83ae2..55e62d90f5a3 100644 --- a/ucb/source/ucp/ftp/test_activedatasink.hxx +++ b/ucb/source/ucp/ftp/test_activedatasink.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_activedatasink.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_ftpurl.cxx b/ucb/source/ucp/ftp/test_ftpurl.cxx index 28d293a141d2..8e623c630aa8 100755 --- a/ucb/source/ucp/ftp/test_ftpurl.cxx +++ b/ucb/source/ucp/ftp/test_ftpurl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_ftpurl.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_interactionhandler.hxx b/ucb/source/ucp/ftp/test_interactionhandler.hxx index c58a4475a69e..a0ea9f9ff75a 100644 --- a/ucb/source/ucp/ftp/test_interactionhandler.hxx +++ b/ucb/source/ucp/ftp/test_interactionhandler.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_interactionhandler.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_multiservicefac.cxx b/ucb/source/ucp/ftp/test_multiservicefac.cxx index b0d1d31fe98c..3c9570516b99 100644 --- a/ucb/source/ucp/ftp/test_multiservicefac.cxx +++ b/ucb/source/ucp/ftp/test_multiservicefac.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_multiservicefac.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/ftp/test_multiservicefac.hxx b/ucb/source/ucp/ftp/test_multiservicefac.hxx index 43024bee63da..874a03f43a1c 100644 --- a/ucb/source/ucp/ftp/test_multiservicefac.hxx +++ b/ucb/source/ucp/ftp/test_multiservicefac.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: test_multiservicefac.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index 84167fedb1f0..bf0d16a654af 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_content.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -402,6 +399,7 @@ static util::DateTime getDateFromUnix (time_t t) uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo *pInfo, const uno::Reference< lang::XMultiServiceFactory >& rSMgr, + const uno::Reference< ucb::XCommandEnvironment > & xEnv, const uno::Sequence< beans::Property >& rProperties) { rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( rSMgr ); @@ -499,6 +497,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValuesFromGFileInfo(GFileInfo * else xRow->appendVoid( rProp ); } + else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) ); + } #ifdef DEBUG else { @@ -520,7 +522,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if (!pInfo) ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); - return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, rProperties); + return getPropertyValuesFromGFileInfo(pInfo, m_xSMgr, xEnv, rProperties); } static lang::IllegalAccessException @@ -663,7 +665,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) || rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) || rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) || - rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) + rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) || + rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) { aRet[ n ] <<= getReadOnlyException( static_cast< cppu::OWeakObject * >(this) ); } @@ -944,6 +947,14 @@ uno::Any SAL_CALL Content::execute( ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv ); aRet <<= setPropertyValues( aProperties, xEnv ); } + else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) + && isFolder( xEnv ) ) + { + ucb::ContentInfo arg; + if ( !( aCommand.Argument >>= arg ) ) + ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv ); + aRet <<= createNewContent( arg ); + } else if (aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "insert" ) )) { ucb::InsertCommandArgument arg; @@ -956,8 +967,8 @@ uno::Any SAL_CALL Content::execute( sal_Bool bDeletePhysical = sal_False; aCommand.Argument >>= bDeletePhysical; - //If no delete physical, try and trashcan it, if that doesn't work go - //ahead and try and delete it anyway + //If no delete physical, try and trashcan it, if that doesn't work go + //ahead and try and delete it anyway if (!bDeletePhysical && !g_file_trash(getGFile(), NULL, NULL)) bDeletePhysical = true; @@ -1079,36 +1090,50 @@ void Content::transfer( const ucb::TransferInfo& aTransferInfo, const uno::Refer ucbhelper::cancelCommandExecution(mapGIOError(pError), xEnv); } -com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() - throw( com::sun::star::uno::RuntimeException ) +uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo( + const uno::Reference< ucb::XCommandEnvironment >& xEnv) + throw( uno::RuntimeException ) { - uno::Sequence< ucb::ContentInfo > seq(2); - - // Minimum set of props we really need - uno::Sequence< beans::Property > props( 1 ); - props[0] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< rtl::OUString* >( 0 ) ), - beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); - - // file - seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE ); - seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | - ucb::ContentInfoAttribute::KIND_DOCUMENT ); - seq[0].Properties = props; - - // folder - seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE ); - seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; - seq[1].Properties = props; - - return seq; + if ( isFolder( xEnv ) ) + { + uno::Sequence< ucb::ContentInfo > seq(2); + + // Minimum set of props we really need + uno::Sequence< beans::Property > props( 1 ); + props[0] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< rtl::OUString* >( 0 ) ), + beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); + + // file + seq[0].Type = rtl::OUString::createFromAscii( GIO_FILE_TYPE ); + seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | + ucb::ContentInfoAttribute::KIND_DOCUMENT ); + seq[0].Properties = props; + + // folder + seq[1].Type = rtl::OUString::createFromAscii( GIO_FOLDER_TYPE ); + seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; + seq[1].Properties = props; + + return seq; + } + else + { + return uno::Sequence< ucb::ContentInfo >(); + } +} + +uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() + throw( uno::RuntimeException ) +{ + return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() ); } -com::sun::star::uno::Reference< com::sun::star::ucb::XContent > - SAL_CALL Content::createNewContent( const com::sun::star::ucb::ContentInfo& Info ) - throw( com::sun::star::uno::RuntimeException ) +uno::Reference< ucb::XContent > + SAL_CALL Content::createNewContent( const ucb::ContentInfo& Info ) + throw( uno::RuntimeException ) { bool create_document; const char *name; @@ -1223,6 +1248,9 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), -1, getCppuBooleanType(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), + beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ), + -1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) }; @@ -1232,7 +1260,7 @@ uno::Sequence< beans::Property > Content::getProperties( uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< ucb::XCommandEnvironment > & xEnv) { - static ucb::CommandInfo aDocumentCommandInfoTable[] = + static ucb::CommandInfo aCommandInfoTable[] = { // Required commands ucb::CommandInfo @@ -1262,11 +1290,14 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< uc // Folder Only, omitted if not a folder ucb::CommandInfo ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), - -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ) + -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ), + ucb::CommandInfo + ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) ) }; - const int nProps = sizeof (aDocumentCommandInfoTable) / sizeof (aDocumentCommandInfoTable[0]); - return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 1); + const int nProps = sizeof (aCommandInfoTable) / sizeof (aCommandInfoTable[0]); + return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2); } XTYPEPROVIDER_COMMON_IMPL( Content ); diff --git a/ucb/source/ucp/gio/gio_content.hxx b/ucb/source/ucp/gio/gio_content.hxx index b98d1d8a69bd..824fa6514379 100644 --- a/ucb/source/ucp/gio/gio_content.hxx +++ b/ucb/source/ucp/gio/gio_content.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_content.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -145,6 +142,7 @@ public: static com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > getPropertyValuesFromGFileInfo( GFileInfo *pInfo, const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr, + const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv, const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& rProperties); virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property > @@ -189,6 +187,11 @@ public: SAL_CALL createNewContent( const com::sun::star::ucb::ContentInfo& Info ) throw( com::sun::star::uno::RuntimeException ); + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + queryCreatableContentsInfo( + const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv) + throw( com::sun::star::uno::RuntimeException ); + GFile* getGFile(); }; diff --git a/ucb/source/ucp/gio/gio_datasupplier.cxx b/ucb/source/ucp/gio/gio_datasupplier.cxx index 5dae9c01f2c0..e7d55039ed27 100644 --- a/ucb/source/ucp/gio/gio_datasupplier.cxx +++ b/ucb/source/ucp/gio/gio_datasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_datasupplier.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -240,7 +237,7 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( sal_uInt32 nInde if ( getResult( nIndex ) ) { uno::Reference< sdbc::XRow > xRow = Content::getPropertyValuesFromGFileInfo( - maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getProperties()); + maResults[ nIndex ]->pInfo, m_xSMgr, getResultSet()->getEnvironment(), getResultSet()->getProperties()); maResults[ nIndex ]->xRow = xRow; return xRow; diff --git a/ucb/source/ucp/gio/gio_datasupplier.hxx b/ucb/source/ucp/gio/gio_datasupplier.hxx index f69ccb3e8448..b39d7c913ffa 100644 --- a/ucb/source/ucp/gio/gio_datasupplier.hxx +++ b/ucb/source/ucp/gio/gio_datasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_datasupplier.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_inputstream.cxx b/ucb/source/ucp/gio/gio_inputstream.cxx index c8b307280987..b5295a71bcd2 100644 --- a/ucb/source/ucp/gio/gio_inputstream.cxx +++ b/ucb/source/ucp/gio/gio_inputstream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_inputstream.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_inputstream.hxx b/ucb/source/ucp/gio/gio_inputstream.hxx index 12563ff486e6..467a14a9a94c 100644 --- a/ucb/source/ucp/gio/gio_inputstream.hxx +++ b/ucb/source/ucp/gio/gio_inputstream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_inputstream.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_mount.cxx b/ucb/source/ucp/gio/gio_mount.cxx index 7360304e8328..a32457c81a75 100644 --- a/ucb/source/ucp/gio/gio_mount.cxx +++ b/ucb/source/ucp/gio/gio_mount.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_mount.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_mount.hxx b/ucb/source/ucp/gio/gio_mount.hxx index d6e57e89fc60..e88ef01651a3 100644 --- a/ucb/source/ucp/gio/gio_mount.hxx +++ b/ucb/source/ucp/gio/gio_mount.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_mount.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_outputstream.cxx b/ucb/source/ucp/gio/gio_outputstream.cxx index 05f9bfbdb176..ddd0d19e7f2b 100644 --- a/ucb/source/ucp/gio/gio_outputstream.cxx +++ b/ucb/source/ucp/gio/gio_outputstream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_outputstream.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_outputstream.hxx b/ucb/source/ucp/gio/gio_outputstream.hxx index 20a036249b36..d1328fc58e3e 100644 --- a/ucb/source/ucp/gio/gio_outputstream.hxx +++ b/ucb/source/ucp/gio/gio_outputstream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_outputstream.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx index 8d5aa9c1fbd6..b39bc4462bbe 100644 --- a/ucb/source/ucp/gio/gio_provider.cxx +++ b/ucb/source/ucp/gio/gio_provider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_provider.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_provider.hxx b/ucb/source/ucp/gio/gio_provider.hxx index 95b928d9c100..4fa2fba1807d 100644 --- a/ucb/source/ucp/gio/gio_provider.hxx +++ b/ucb/source/ucp/gio/gio_provider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_provider.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_resultset.cxx b/ucb/source/ucp/gio/gio_resultset.cxx index 4934b6ee54a5..68c3654915f6 100644 --- a/ucb/source/ucp/gio/gio_resultset.cxx +++ b/ucb/source/ucp/gio/gio_resultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_resultset.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_resultset.hxx b/ucb/source/ucp/gio/gio_resultset.hxx index d5a24e9b864f..620c58cf7edb 100644 --- a/ucb/source/ucp/gio/gio_resultset.hxx +++ b/ucb/source/ucp/gio/gio_resultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_resultset.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_seekable.cxx b/ucb/source/ucp/gio/gio_seekable.cxx index af1f707dd233..3bfce6b9b6b9 100644 --- a/ucb/source/ucp/gio/gio_seekable.cxx +++ b/ucb/source/ucp/gio/gio_seekable.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_seekable.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/gio_seekable.hxx b/ucb/source/ucp/gio/gio_seekable.hxx index e32ad844402e..43324b0651a1 100644 --- a/ucb/source/ucp/gio/gio_seekable.hxx +++ b/ucb/source/ucp/gio/gio_seekable.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: gio_seekable.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gio/makefile.mk b/ucb/source/ucp/gio/makefile.mk index 2e7009e52ab2..e6ebe2413e44 100644 --- a/ucb/source/ucp/gio/makefile.mk +++ b/ucb/source/ucp/gio/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gvfs/content.cxx b/ucb/source/ucp/gvfs/gvfs_content.cxx index 743043c09fc7..3b1d726f9304 100644 --- a/ucb/source/ucp/gvfs/content.cxx +++ b/ucb/source/ucp/gvfs/gvfs_content.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: content.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,9 +36,7 @@ #include "osl/doublecheckedlocking.h" -#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> -#endif #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertySetInfoChange.hpp> #include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp> @@ -50,14 +45,10 @@ #include <com/sun/star/lang/IllegalAccessException.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> -#endif #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> #include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKGENBERALEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp> -#endif #include <com/sun/star/ucb/InteractiveNetworkReadException.hpp> #include <com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp> #include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp> @@ -79,9 +70,7 @@ #include <com/sun/star/ucb/NameClashException.hpp> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/propertyvalueset.hxx> -#ifndef _UCBHELPER_INTERACTIONREQUEST_HXX #include <ucbhelper/interactionrequest.hxx> -#endif #include <ucbhelper/cancelcommandexecution.hxx> #include <ucbhelper/simpleauthenticationrequest.hxx> @@ -98,10 +87,10 @@ extern "C" { // missing in the header: doh. # include <libgnomevfs/gnome-vfs-module-callback.h> } -#include "content.hxx" -#include "provider.hxx" -#include "directory.hxx" -#include "stream.hxx" +#include "gvfs_content.hxx" +#include "gvfs_provider.hxx" +#include "gvfs_directory.hxx" +#include "gvfs_stream.hxx" using namespace gvfs; using namespace com::sun::star; @@ -398,6 +387,13 @@ uno::Any SAL_CALL Content::execute( g_warning ("Open falling through ..."); #endif + } else if ( COMMAND_IS( aCommand, "createNewContent" ) && isFolder( xEnv ) ) { + ucb::ContentInfo arg; + if ( !( aCommand.Argument >>= arg ) ) + ucbhelper::cancelCommandExecution ( getBadArgExcept (), xEnv ); + + aRet <<= createNewContent( arg ); + } else if ( COMMAND_IS( aCommand, "insert" ) ) { ucb::InsertCommandArgument arg; if ( !( aCommand.Argument >>= arg ) ) @@ -452,32 +448,45 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) // XContentCreator methods. // -uno::Sequence< ucb::ContentInfo > SAL_CALL -Content::queryCreatableContentsInfo() - throw( uno::RuntimeException ) +uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo( + const uno::Reference< ucb::XCommandEnvironment >& xEnv) + throw( uno::RuntimeException ) { - uno::Sequence< ucb::ContentInfo > seq(2); - - // Minimum set of props we really need - uno::Sequence< beans::Property > props( 1 ); - props[0] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< rtl::OUString* >( 0 ) ), - beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); - - // file - seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE ); - seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | - ucb::ContentInfoAttribute::KIND_DOCUMENT ); - seq[0].Properties = props; - - // folder - seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE ); - seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; - seq[1].Properties = props; - - return seq; + if ( isFolder( xEnv ) ) + { + uno::Sequence< ucb::ContentInfo > seq(2); + + // Minimum set of props we really need + uno::Sequence< beans::Property > props( 1 ); + props[0] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< rtl::OUString* >( 0 ) ), + beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); + + // file + seq[0].Type = rtl::OUString::createFromAscii( GVFS_FILE_TYPE ); + seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | + ucb::ContentInfoAttribute::KIND_DOCUMENT ); + seq[0].Properties = props; + + // folder + seq[1].Type = rtl::OUString::createFromAscii( GVFS_FOLDER_TYPE ); + seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; + seq[1].Properties = props; + + return seq; + } + else + { + return uno::Sequence< ucb::ContentInfo >(); + } +} + +uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() + throw( uno::RuntimeException ) +{ + return queryCreatableContentsInfo( uno::Reference< ucb::XCommandEnvironment >() ); } uno::Reference< ucb::XContent > SAL_CALL @@ -487,7 +496,7 @@ Content::createNewContent( const ucb::ContentInfo& Info ) bool create_document; const char *name; - if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FILE_TYPE ) ) ) + if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FILE_TYPE ) ) ) create_document = true; else if ( Info.Type.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( GVFS_FOLDER_TYPE ) ) ) create_document = false; @@ -515,11 +524,11 @@ Content::createNewContent( const ucb::ContentInfo& Info ) uno::Reference< ucb::XContentIdentifier > xId ( new ::ucbhelper::ContentIdentifier( m_xSMgr, aURL ) ); - try { + try { return new ::gvfs::Content( m_xSMgr, m_pProvider, xId, !create_document ); } catch ( ucb::ContentCreationException & ) { return uno::Reference< ucb::XContent >(); - } + } } rtl::OUString Content::getParentURL() @@ -617,38 +626,38 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( else xRow->appendVoid( rProp ); } - else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ) { if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) xRow->appendBoolean( rProp, ( m_info.type == GNOME_VFS_FILE_TYPE_DIRECTORY ) ); else xRow->appendVoid( rProp ); } + else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) ) { - else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) { - if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) - xRow->appendLong( rProp, m_info.size ); - else - xRow->appendVoid( rProp ); - } + GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new (); - else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) ) { - if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS) { + ::rtl::OString aURI = getOURI(); + gnome_vfs_get_file_info + ( (const sal_Char *)aURI, fileInfo, + GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS ); + + if (fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ACCESS) { bool read_only = true; - if (m_info.uid == getuid () && - m_info.permissions & GNOME_VFS_PERM_USER_WRITE) - read_only = false; - else if (m_info.gid == getgid () && - m_info.permissions & GNOME_VFS_PERM_GROUP_WRITE) - read_only = false; - else if (m_info.permissions & GNOME_VFS_PERM_OTHER_WRITE) - read_only = false; + if (fileInfo->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) + read_only = false; + xRow->appendBoolean( rProp, read_only ); } else xRow->appendVoid( rProp ); + gnome_vfs_file_info_unref (fileInfo); + } + else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) { + if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) + xRow->appendLong( rProp, m_info.size ); + else + xRow->appendVoid( rProp ); } - else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsHidden" ) ) ) xRow->appendBoolean( rProp, ( m_info.name && m_info.name[0] == '.' ) ); @@ -676,7 +685,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( g_warning ("FIXME: Requested mime-type - an expensive op. indeed!"); #endif xRow->appendVoid( rProp ); - } else { + } else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) ); + + else { xRow->appendVoid( rProp ); } } @@ -757,7 +769,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( getInfo( xEnv ); - osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); + osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); gnome_vfs_file_info_copy( &newInfo, &m_info ); @@ -769,16 +781,16 @@ uno::Sequence< uno::Any > Content::setPropertyValues( beans::PropertyChangeEvent aEvent; aEvent.Source = static_cast< cppu::OWeakObject * >( this ); - aEvent.Further = sal_False; - aEvent.PropertyHandle = -1; - // aEvent.PropertyName = fill in later ... - // aEvent.OldValue = - // aEvent.NewValue = + aEvent.Further = sal_False; + aEvent.PropertyHandle = -1; + // aEvent.PropertyName = fill in later ... + // aEvent.OldValue = + // aEvent.NewValue = - int nCount = rValues.getLength(); + int nCount = rValues.getLength(); const beans::PropertyValue* pValues = rValues.getConstArray(); - for ( sal_Int32 n = 0; n < nCount; ++n ) { + for ( sal_Int32 n = 0; n < nCount; ++n ) { const beans::PropertyValue& rValue = pValues[ n ]; #ifdef DEBUG @@ -788,7 +800,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) || rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsDocument" ) ) || rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) || - rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) ) + rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) || + rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) aRet[ n ] <<= getReadOnlyException( this ); else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { @@ -919,7 +932,7 @@ void Content::insert( const uno::Reference< ucb::XCommandEnvironment > &xEnv ) throw( uno::Exception ) { - osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); + osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); #ifdef DEBUG g_warning( "Insert '%s' (%d) (0x%x:%d)", getURI(), bReplaceExisting, @@ -1004,9 +1017,9 @@ void Content::insert( } if (m_bTransient) { - m_bTransient = sal_False; + m_bTransient = sal_False; aGuard.clear(); - inserted(); + inserted(); } } @@ -1319,8 +1332,8 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), // FIXME: Too expensive for now (?) // beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ), -// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), -// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), +// -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), +// beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ), -1, getCppuType( static_cast< const sal_Int64 * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), @@ -1335,6 +1348,9 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), -1, getCppuBooleanType(), + beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), + beans::Property( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ), + -1, getCppuType( static_cast< const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) }; @@ -1347,7 +1363,7 @@ uno::Sequence< beans::Property > Content::getProperties( uno::Sequence< ucb::CommandInfo > Content::getCommands( const uno::Reference< ucb::XCommandEnvironment > & xEnv ) { - static ucb::CommandInfo aDocumentCommandInfoTable[] = { + static ucb::CommandInfo aCommandInfoTable[] = { // Required commands ucb::CommandInfo ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), @@ -1373,17 +1389,19 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), -1, getCppuType( static_cast<ucb::OpenCommandArgument2 * >( 0 ) ) ), - // Folder only + // Folder Only, omitted if not a folder ucb::CommandInfo ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), - -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ) + -1, getCppuType( static_cast<ucb::TransferInfo * >( 0 ) ) ), + ucb::CommandInfo + ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, getCppuType( static_cast<ucb::ContentInfo * >( 0 ) ) ) }; - int num = 7; - - if ( isFolder( xEnv ) ) - num += 1; - return uno::Sequence< ucb::CommandInfo >(aDocumentCommandInfoTable, num ); + const int nProps + = sizeof( aCommandInfoTable ) / sizeof( aCommandInfoTable[ 0 ] ); + return uno::Sequence< ucb::CommandInfo >( + aCommandInfoTable, isFolder( xEnv ) ? nProps : nProps - 2 ); } rtl::OUString diff --git a/ucb/source/ucp/gvfs/content.hxx b/ucb/source/ucp/gvfs/gvfs_content.hxx index cd6701b8c742..b2f6bec4ca11 100644 --- a/ucb/source/ucp/gvfs/content.hxx +++ b/ucb/source/ucp/gvfs/gvfs_content.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: content.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -82,11 +79,11 @@ class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator { //========================================================================= -// Internals +// Internals //========================================================================= private: typedef rtl::Reference< Content > ContentRef; - typedef std::list< ContentRef > ContentRefList; + typedef std::list< ContentRef > ContentRefList; // Instance data ContentProvider *m_pProvider; // No need for a ref, base class holds object @@ -98,7 +95,7 @@ private: ::com::sun::star::uno::Any getBadArgExcept (); GnomeVFSResult getInfo ( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); - sal_Bool isFolder ( const ::com::sun::star::uno::Reference< + sal_Bool isFolder ( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); sal_Bool exchangeIdentity( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& xNewId); @@ -110,7 +107,7 @@ private: // End Internal helpers // For ucbhelper - virtual ::rtl::OUString getParentURL(); + virtual ::rtl::OUString getParentURL(); // For ucbhelper virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties( const com::sun::star::uno::Reference< @@ -122,8 +119,8 @@ private: public: // Command "getPropertyValues" - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > - getPropertyValues( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > + getPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); @@ -136,22 +133,22 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >& xEnv ); - // Command "insert" - void insert( const ::com::sun::star::uno::Reference< + // Command "insert" + void insert( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & xInputStream, - sal_Bool bReplaceExisting, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& xEnv ) + sal_Bool bReplaceExisting, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( ::com::sun::star::uno::Exception ); // Command "transfer" void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& xEnv ) + com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( ::com::sun::star::uno::Exception ); // Command "delete" - void destroy( sal_Bool bDeletePhysical ) + void destroy( sal_Bool bDeletePhysical ) throw( ::com::sun::star::uno::Exception ); // "open" helpers @@ -170,12 +167,12 @@ private: createInputStream( const ::com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( ::com::sun::star::uno::Exception ); - sal_Bool feedSink( ::com::sun::star::uno::Reference< + sal_Bool feedSink( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> aSink, const ::com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ); - ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result, + ::com::sun::star::uno::Any mapVFSException( const GnomeVFSResult result, sal_Bool bWrite ); void cancelCommandExecution(const GnomeVFSResult result, @@ -192,27 +189,27 @@ public: rtl::OUString getOUURI (); //========================================================================= -// Externals +// Externals //========================================================================= public: - Content( const ::com::sun::star::uno::Reference< + Content( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier) throw ( ::com::sun::star::ucb::ContentCreationException ); - Content( const ::com::sun::star::uno::Reference< + Content( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, ContentProvider *pProvider, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentIdentifier >& Identifier, sal_Bool isFolder) throw ( ::com::sun::star::ucb::ContentCreationException ); - virtual ~Content(); + virtual ~Content(); - // XInterface - XINTERFACE_DECL() + // XInterface + XINTERFACE_DECL() // XTypeProvider XTYPEPROVIDER_DECL() @@ -220,40 +217,47 @@ public: // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - // XContent - virtual rtl::OUString SAL_CALL - getContentType() + // XContent + virtual rtl::OUString SAL_CALL + getContentType() throw( com::sun::star::uno::RuntimeException ); - // XCommandProcessor - virtual com::sun::star::uno::Any SAL_CALL - execute( const com::sun::star::ucb::Command& aCommand, + // XCommandProcessor + virtual com::sun::star::uno::Any SAL_CALL + execute( const com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL - abort( sal_Int32 CommandId ) + virtual void SAL_CALL + abort( sal_Int32 CommandId ) throw( com::sun::star::uno::RuntimeException ); - ////////////////////////////////////////////////////////////////////// - // Additional interfaces - ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // Additional interfaces + ////////////////////////////////////////////////////////////////////// - // XContentCreator + // XContentCreator virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL - queryCreatableContentsInfo() + queryCreatableContentsInfo() throw( com::sun::star::uno::RuntimeException ); - virtual com::sun::star::uno::Reference< - com::sun::star::ucb::XContent > SAL_CALL - createNewContent( const com::sun::star::ucb::ContentInfo& Info ) + virtual com::sun::star::uno::Reference< + com::sun::star::ucb::XContent > SAL_CALL + createNewContent( const com::sun::star::ucb::ContentInfo& Info ) + throw( com::sun::star::uno::RuntimeException ); + + + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + queryCreatableContentsInfo( + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& xEnv) throw( com::sun::star::uno::RuntimeException ); }; diff --git a/ucb/source/ucp/gvfs/directory.cxx b/ucb/source/ucp/gvfs/gvfs_directory.cxx index 19ace5ebf162..b93f34d9003f 100644 --- a/ucb/source/ucp/gvfs/directory.cxx +++ b/ucb/source/ucp/gvfs/gvfs_directory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: directory.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -40,7 +37,7 @@ #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/providerhelper.hxx> -#include "directory.hxx" +#include "gvfs_directory.hxx" #include <libgnomevfs/gnome-vfs-utils.h> #include <libgnomevfs/gnome-vfs-directory.h> @@ -96,7 +93,7 @@ struct ResultListEntry gnome_vfs_file_info_copy (&aInfo, fileInfo); } - ~ResultListEntry() + ~ResultListEntry() { gnome_vfs_file_info_clear (&aInfo); } @@ -360,25 +357,24 @@ sal_Bool DataSupplier::getData() g_free( uri ); } + GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new (); - GnomeVFSFileInfo fileInfo; - fileInfo.name = 0; - while ((result = gnome_vfs_directory_read_next (dirHandle, &fileInfo)) == GNOME_VFS_OK) { - if( fileInfo.name && fileInfo.name[0] == '.' && - ( fileInfo.name[1] == '\0' || - ( fileInfo.name[1] == '.' && fileInfo.name[2] == '\0' ) ) ) + while ((result = gnome_vfs_directory_read_next (dirHandle, fileInfo)) == GNOME_VFS_OK) { + if( fileInfo->name && fileInfo->name[0] == '.' && + ( fileInfo->name[1] == '\0' || + ( fileInfo->name[1] == '.' && fileInfo->name[2] == '\0' ) ) ) continue; switch ( m_pImpl->m_nOpenMode ) { case ucb::OpenMode::FOLDERS: - if ( !(fileInfo.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || - fileInfo.type != GNOME_VFS_FILE_TYPE_DIRECTORY ) + if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || + fileInfo->type != GNOME_VFS_FILE_TYPE_DIRECTORY ) continue; break; case ucb::OpenMode::DOCUMENTS: - if ( !(fileInfo.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || - fileInfo.type != GNOME_VFS_FILE_TYPE_REGULAR ) + if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || + fileInfo->type != GNOME_VFS_FILE_TYPE_REGULAR ) continue; break; @@ -387,8 +383,11 @@ sal_Bool DataSupplier::getData() break; } - m_pImpl->m_aResults.push_back( new ResultListEntry( &fileInfo ) ); + m_pImpl->m_aResults.push_back( new ResultListEntry( fileInfo ) ); } + + gnome_vfs_file_info_unref (fileInfo); + #ifdef DEBUG g_warning ("Got %d directory entries", result); #endif diff --git a/ucb/source/ucp/gvfs/directory.hxx b/ucb/source/ucp/gvfs/gvfs_directory.hxx index b3513c2d6048..f914554f7736 100644 --- a/ucb/source/ucp/gvfs/directory.hxx +++ b/ucb/source/ucp/gvfs/gvfs_directory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: directory.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,7 @@ #include <rtl/ref.hxx> #include <ucbhelper/resultset.hxx> #include <ucbhelper/resultsethelper.hxx> -#include "content.hxx" +#include "gvfs_content.hxx" namespace gvfs { @@ -44,11 +41,11 @@ class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper com::sun::star::ucb::XCommandEnvironment > m_xEnv; private: - virtual void initStatic(); - virtual void initDynamic(); + virtual void initStatic(); + virtual void initDynamic(); public: - DynamicResultSet( const com::sun::star::uno::Reference< + DynamicResultSet( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rxSMgr, const rtl::Reference< Content >& rxContent, const com::sun::star::ucb::OpenCommandArgument2& rCommand, diff --git a/ucb/source/ucp/gvfs/provider.cxx b/ucb/source/ucp/gvfs/gvfs_provider.cxx index c342fe2a6f63..52376bf4153e 100644 --- a/ucb/source/ucp/gvfs/provider.cxx +++ b/ucb/source/ucp/gvfs/gvfs_provider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: provider.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,8 +30,8 @@ #include <ucbhelper/contentidentifier.hxx> #include <libgnomevfs/gnome-vfs-init.h> -#include "provider.hxx" -#include "content.hxx" +#include "gvfs_provider.hxx" +#include "gvfs_content.hxx" using namespace com::sun::star; using namespace gvfs; diff --git a/ucb/source/ucp/gvfs/provider.hxx b/ucb/source/ucp/gvfs/gvfs_provider.hxx index 8703344c33a9..fd9e7dfd7876 100644 --- a/ucb/source/ucp/gvfs/provider.hxx +++ b/ucb/source/ucp/gvfs/gvfs_provider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: provider.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gvfs/stream.cxx b/ucb/source/ucp/gvfs/gvfs_stream.cxx index 364108746f7b..ab0c6ed90fc0 100644 --- a/ucb/source/ucp/gvfs/stream.cxx +++ b/ucb/source/ucp/gvfs/gvfs_stream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stream.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,7 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucb.hxx" -#include "stream.hxx" +#include "gvfs_stream.hxx" #include <rtl/memory.h> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> @@ -187,9 +184,9 @@ sal_Int32 SAL_CALL Stream::available( ) } void SAL_CALL Stream::closeInput( void ) - throw( NotConnectedException, - IOException, - RuntimeException ) + throw( NotConnectedException, + IOException, + RuntimeException ) { osl::MutexGuard aGuard( m_aMutex ); m_bInputStreamCalled = false; diff --git a/ucb/source/ucp/gvfs/stream.hxx b/ucb/source/ucp/gvfs/gvfs_stream.hxx index 1d22918ce566..93815f6b2321 100644 --- a/ucb/source/ucp/gvfs/stream.hxx +++ b/ucb/source/ucp/gvfs/gvfs_stream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stream.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/gvfs/makefile.mk b/ucb/source/ucp/gvfs/makefile.mk index 889e3ffd415d..b69455777c62 100644 --- a/ucb/source/ucp/gvfs/makefile.mk +++ b/ucb/source/ucp/gvfs/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -62,10 +58,10 @@ PKGCONFIG_LIBS!:=-Wl,--export-dynamic $(PKGCONFIG_LIBS:s/ -llinc//:s/ -lbonobo-a DLLPRE = SLOFILES=\ - $(SLO)$/content.obj \ - $(SLO)$/directory.obj \ - $(SLO)$/stream.obj \ - $(SLO)$/provider.obj + $(SLO)$/gvfs_content.obj \ + $(SLO)$/gvfs_directory.obj \ + $(SLO)$/gvfs_stream.obj \ + $(SLO)$/gvfs_provider.obj SHL1NOCHECK=TRUE SHL1TARGET=$(TARGET)$(UCPGVFS_MAJOR).uno diff --git a/ucb/source/ucp/hierarchy/dynamicresultset.cxx b/ucb/source/ucp/hierarchy/dynamicresultset.cxx index 746ded24e704..0cb8fec28e17 100644 --- a/ucb/source/ucp/hierarchy/dynamicresultset.cxx +++ b/ucb/source/ucp/hierarchy/dynamicresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dynamicresultset.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/dynamicresultset.hxx b/ucb/source/ucp/hierarchy/dynamicresultset.hxx index 2f4a07a14b6e..9553b299b0ad 100644 --- a/ucb/source/ucp/hierarchy/dynamicresultset.hxx +++ b/ucb/source/ucp/hierarchy/dynamicresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dynamicresultset.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx index b3dfaba1fbb8..2243692549e6 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchycontent.cxx,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,7 +38,7 @@ ************************************************************************** - Root Folder vs. 'normal' Folder - - root doesn't support command 'delete' + - root doesn't support command 'delete' - root doesn't support command 'insert' - root needs not created via XContentCreator - queryContent with root folder id ( HIERARCHY_ROOT_FOLDER_URL ) always returns a value != 0 @@ -457,8 +454,8 @@ uno::Any SAL_CALL HierarchyContent::execute( aRet <<= getCommandInfo( Environment ); } - else if ( isFolder() && aCommand.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "open" ) ) ) + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "open" ) ) && isFolder() ) { ////////////////////////////////////////////////////////////////// // open command for a folder content @@ -481,9 +478,9 @@ uno::Any SAL_CALL HierarchyContent::execute( = new DynamicResultSet( m_xSMgr, this, aOpenCommand ); aRet <<= xSet; } - else if ( ( m_eKind != ROOT ) && !isReadOnly() && - aCommand.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "insert" ) ) ) + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "insert" ) ) && + ( m_eKind != ROOT ) && !isReadOnly() ) { ////////////////////////////////////////////////////////////////// // insert @@ -508,9 +505,9 @@ uno::Any SAL_CALL HierarchyContent::execute( : ucb::NameClash::ERROR; insert( nNameClash, Environment ); } - else if ( ( m_eKind != ROOT ) && !isReadOnly() && - aCommand.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "delete" ) ) ) + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "delete" ) ) && + ( m_eKind != ROOT ) && !isReadOnly() ) { ////////////////////////////////////////////////////////////////// // delete @@ -546,13 +543,13 @@ uno::Any SAL_CALL HierarchyContent::execute( // Remove own and all children's Additional Core Properties. removeAdditionalPropertySet( sal_True ); } - else if ( isFolder() && !isReadOnly() && - aCommand.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) ) + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "transfer" ) ) && + isFolder() && !isReadOnly() ) { ////////////////////////////////////////////////////////////////// // transfer - // ( Not available at link objects ) + // ( Not available at link objects ) ////////////////////////////////////////////////////////////////// ucb::TransferInfo aInfo; @@ -571,6 +568,31 @@ uno::Any SAL_CALL HierarchyContent::execute( transfer( aInfo, Environment ); } + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) && + isFolder() && !isReadOnly() ) + { + ////////////////////////////////////////////////////////////////// + // createNewContent + // ( Not available at link objects ) + ////////////////////////////////////////////////////////////////// + + ucb::ContentInfo aInfo; + if ( !( aCommand.Argument >>= aInfo ) ) + { + OSL_ENSURE( sal_False, "Wrong argument type!" ); + ucbhelper::cancelCommandExecution( + uno::makeAny( lang::IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >( this ), + -1 ) ), + Environment ); + // Unreachable + } + + aRet <<= createNewContent( aInfo ); + } else { ////////////////////////////////////////////////////////////////// @@ -607,54 +629,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL HierarchyContent::queryCreatableContentsInfo() throw( uno::RuntimeException ) { - if ( isFolder() ) - { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - - uno::Sequence< ucb::ContentInfo > aSeq( 2 ); - - // Folder. - aSeq.getArray()[ 0 ].Type - = rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE ); - aSeq.getArray()[ 0 ].Attributes - = ucb::ContentInfoAttribute::KIND_FOLDER; - - uno::Sequence< beans::Property > aFolderProps( 1 ); - aFolderProps.getArray()[ 0 ] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - beans::PropertyAttribute::BOUND ); - aSeq.getArray()[ 0 ].Properties = aFolderProps; - - // Link. - aSeq.getArray()[ 1 ].Type - = rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE ); - aSeq.getArray()[ 1 ].Attributes - = ucb::ContentInfoAttribute::KIND_LINK; - - uno::Sequence< beans::Property > aLinkProps( 2 ); - aLinkProps.getArray()[ 0 ] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - beans::PropertyAttribute::BOUND ); - aLinkProps.getArray()[ 1 ] = beans::Property( - rtl::OUString::createFromAscii( "TargetURL" ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - beans::PropertyAttribute::BOUND ); - aSeq.getArray()[ 1 ].Properties = aLinkProps; - - return aSeq; - } - else - { - OSL_ENSURE( sal_False, - "queryCreatableContentsInfo called on non-folder object!" ); - - return uno::Sequence< ucb::ContentInfo >( 0 ); - } + return m_aProps.getCreatableContentsInfo(); } //========================================================================= @@ -1026,7 +1001,7 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues( xRow->appendString ( rProp, rData.getContentType() ); } else if ( rProp.Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) + RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { xRow->appendString ( rProp, rData.getTitle() ); } @@ -1041,6 +1016,12 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues( xRow->appendBoolean( rProp, rData.getIsFolder() ); } else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + xRow->appendObject( + rProp, uno::makeAny( rData.getCreatableContentsInfo() ) ); + } + else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TargetURL" ) ) ) { // TargetURL is only supported by links. @@ -1123,6 +1104,15 @@ uno::Reference< sdbc::XRow > HierarchyContent::getPropertyValues( // @@@ Might actually be read-only! beans::PropertyAttribute::BOUND ), rData.getTargetURL() ); + xRow->appendObject( + beans::Property( + rtl::OUString::createFromAscii( "CreatableContentsInfo" ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ), + uno::makeAny( rData.getCreatableContentsInfo() ) ); // Append all Additional Core Properties. @@ -1162,10 +1152,10 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues( beans::PropertyChangeEvent aEvent; aEvent.Source = static_cast< cppu::OWeakObject * >( this ); aEvent.Further = sal_False; -// aEvent.PropertyName = +// aEvent.PropertyName = aEvent.PropertyHandle = -1; -// aEvent.OldValue = -// aEvent.NewValue = +// aEvent.OldValue = +// aEvent.NewValue = const beans::PropertyValue* pValues = rValues.getConstArray(); sal_Int32 nCount = rValues.getLength(); @@ -1210,6 +1200,15 @@ uno::Sequence< uno::Any > HierarchyContent::setPropertyValues( static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } + else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { if ( isReadOnly() ) @@ -1953,3 +1952,58 @@ void HierarchyContent::transfer( } } +//========================================================================= +//========================================================================= +// +// HierarchyContentProperties Implementation. +// +//========================================================================= +//========================================================================= + +uno::Sequence< ucb::ContentInfo > +HierarchyContentProperties::getCreatableContentsInfo() const +{ + if ( getIsFolder() ) + { + uno::Sequence< ucb::ContentInfo > aSeq( 2 ); + + // Folder. + aSeq.getArray()[ 0 ].Type + = rtl::OUString::createFromAscii( HIERARCHY_FOLDER_CONTENT_TYPE ); + aSeq.getArray()[ 0 ].Attributes + = ucb::ContentInfoAttribute::KIND_FOLDER; + + uno::Sequence< beans::Property > aFolderProps( 1 ); + aFolderProps.getArray()[ 0 ] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ); + aSeq.getArray()[ 0 ].Properties = aFolderProps; + + // Link. + aSeq.getArray()[ 1 ].Type + = rtl::OUString::createFromAscii( HIERARCHY_LINK_CONTENT_TYPE ); + aSeq.getArray()[ 1 ].Attributes + = ucb::ContentInfoAttribute::KIND_LINK; + + uno::Sequence< beans::Property > aLinkProps( 2 ); + aLinkProps.getArray()[ 0 ] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ); + aLinkProps.getArray()[ 1 ] = beans::Property( + rtl::OUString::createFromAscii( "TargetURL" ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ); + aSeq.getArray()[ 1 ].Properties = aLinkProps; + + return aSeq; + } + else + { + return uno::Sequence< ucb::ContentInfo >( 0 ); + } +} diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.hxx b/ucb/source/ucp/hierarchy/hierarchycontent.hxx index b85f2aac781e..5b7360a87719 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontent.hxx +++ b/ucb/source/ucp/hierarchy/hierarchycontent.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchycontent.hxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -101,6 +98,9 @@ public: sal_Bool getIsDocument() const { return !getIsFolder(); } + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + getCreatableContentsInfo() const; + const HierarchyEntryData & getHierarchyEntryData() const { return m_aData; } private: @@ -117,7 +117,7 @@ class HierarchyContent : public ::ucbhelper::ContentImplHelper, { enum ContentKind { LINK, FOLDER, ROOT }; enum ContentState { TRANSIENT, // created via CreateNewContent, - // but did not process "insert" yet + // but did not process "insert" yet PERSISTENT, // processed "insert" DEAD // processed "delete" }; @@ -198,7 +198,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > getPropertyValues( const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties ); + ::com::sun::star::beans::Property >& rProperties ); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > setPropertyValues( const ::com::sun::star::uno::Sequence< @@ -270,7 +270,7 @@ public: execute( const com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException ); @@ -300,7 +300,7 @@ public: getPropertyValues( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties, + ::com::sun::star::beans::Property >& rProperties, const HierarchyContentProperties& rData, HierarchyContentProvider* pProvider, const ::rtl::OUString& rContentId ); diff --git a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx index 117819ff0e70..a5371c213f1c 100644 --- a/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx +++ b/ucb/source/ucp/hierarchy/hierarchycontentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchycontentcaps.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,25 +36,28 @@ Props/Commands: - root folder folder link link - (new) (new) + root folder folder link link + (new) (new) ---------------------------------------------------------------- - ContentType x x x x x - IsDocument x x x x x - IsFolder x x x x x - Title x x x x x - TargetURL x x + ContentType x x x x x + IsDocument x x x x x + IsFolder x x x x x + Title x x x x x + TargetURL x x + CreatableContentsInfo x x x x x - getCommandInfo x x x x x - getPropertySetInfo x x x x x - getPropertyValues x x x x x - setPropertyValues x x x x x - insert x x - delete x x - open x x - transfer x x + getCommandInfo x x x x x + getPropertySetInfo x x x x x + getPropertyValues x x x x x + setPropertyValues x x x x x + createNewContent x x + insert x x + delete x x + open x x + transfer x x *************************************************************************/ + #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -76,6 +76,12 @@ using namespace hierarchy_ucp; // //========================================================================= +#define MAKEPROPSEQUENCE( a ) \ + uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + +#define MAKECMDSEQUENCE( a ) \ + uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + //========================================================================= // // IMPORTENT: If any property data ( name / type / ... ) are changed, then @@ -143,13 +149,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY - ) + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// }; - return uno::Sequence< - beans::Property >( aLinkPropertyInfoTable, 5 ); + return MAKEPROPSEQUENCE( aLinkPropertyInfoTable ); } else { @@ -195,13 +208,20 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND - ) + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// }; - return uno::Sequence< - beans::Property >( aLinkPropertyInfoTable, 5 ); + return MAKEPROPSEQUENCE( aLinkPropertyInfoTable ); } } else if ( m_eKind == FOLDER ) @@ -248,16 +268,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY - ) + ), /////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// }; - return uno::Sequence< - beans::Property >( aFolderPropertyInfoTable, 4 ); + return MAKEPROPSEQUENCE( aFolderPropertyInfoTable ); } else { @@ -294,16 +321,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND - ) + ), /////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// }; - return uno::Sequence< - beans::Property >( aFolderPropertyInfoTable, 4 ); + return MAKEPROPSEQUENCE( aFolderPropertyInfoTable ); } } else @@ -314,6 +348,9 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( // //================================================================= + // Currently no difference between reonly /read-write + // -> all props ar read-only + static beans::Property aRootFolderPropertyInfoTable[] = { /////////////////////////////////////////////////////////////// @@ -346,16 +383,23 @@ uno::Sequence< beans::Property > HierarchyContent::getProperties( getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY - ) + ), /////////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////////// }; - return uno::Sequence< - beans::Property >( aRootFolderPropertyInfoTable, 4 ); + return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable ); } } @@ -416,8 +460,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aLinkCommandInfoTable, 4 ); + return MAKECMDSEQUENCE( aLinkCommandInfoTable ); } else { @@ -470,8 +513,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aLinkCommandInfoTable, 6 ); + return MAKECMDSEQUENCE( aLinkCommandInfoTable ); } } else if ( m_eKind == FOLDER ) @@ -529,8 +571,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aFolderCommandInfoTable, 5 ); + return MAKECMDSEQUENCE( aFolderCommandInfoTable ); } else { @@ -589,13 +630,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), -1, getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) + ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ) /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aFolderCommandInfoTable, 8 ); + return MAKECMDSEQUENCE( aFolderCommandInfoTable ); } } else @@ -653,8 +699,7 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aRootFolderCommandInfoTable, 5 ); + return MAKECMDSEQUENCE( aRootFolderCommandInfoTable ); } else { @@ -703,13 +748,18 @@ uno::Sequence< ucb::CommandInfo > HierarchyContent::getCommands( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), -1, getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) + ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ) /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aRootFolderCommandInfoTable, 6 ); + return MAKECMDSEQUENCE( aRootFolderCommandInfoTable ); } } } diff --git a/ucb/source/ucp/hierarchy/hierarchydata.cxx b/ucb/source/ucp/hierarchy/hierarchydata.cxx index b94121207560..d2e8f5031527 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydata.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchydata.hxx b/ucb/source/ucp/hierarchy/hierarchydata.hxx index 2d5679a42fac..769611342baf 100644 --- a/ucb/source/ucp/hierarchy/hierarchydata.hxx +++ b/ucb/source/ucp/hierarchy/hierarchydata.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydata.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx index 939249c6a90c..467259caf0eb 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydatasource.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx index 0e794bb8c46a..329011e142db 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydatasource.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx index c7eb4490cb96..8cd53a4a6201 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydatasupplier.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx b/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx index 9273088882c6..87218e0729d0 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchydatasupplier.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index 4f2ddd109867..5ce8ea891f51 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchyprovider.cxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.hxx b/ucb/source/ucp/hierarchy/hierarchyprovider.hxx index e8cb5102ab0b..9212aadf417e 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.hxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchyprovider.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchyservices.cxx b/ucb/source/ucp/hierarchy/hierarchyservices.cxx index 4a47a6cade6c..e645e006032e 100644 --- a/ucb/source/ucp/hierarchy/hierarchyservices.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyservices.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchyservices.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchyuri.cxx b/ucb/source/ucp/hierarchy/hierarchyuri.cxx index e5540cb704e7..0621db72d5bb 100644 --- a/ucb/source/ucp/hierarchy/hierarchyuri.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyuri.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchyuri.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/hierarchyuri.hxx b/ucb/source/ucp/hierarchy/hierarchyuri.hxx index 81d55b1ac86a..012d59bb4cf2 100644 --- a/ucb/source/ucp/hierarchy/hierarchyuri.hxx +++ b/ucb/source/ucp/hierarchy/hierarchyuri.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hierarchyuri.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/hierarchy/makefile.mk b/ucb/source/ucp/hierarchy/makefile.mk index b71ee7fa1817..a968537873dc 100644 --- a/ucb/source/ucp/hierarchy/makefile.mk +++ b/ucb/source/ucp/hierarchy/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.15 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/inc/urihelper.hxx b/ucb/source/ucp/inc/urihelper.hxx index 97b0bfe2fb10..a67fbe0564c1 100644 --- a/ucb/source/ucp/inc/urihelper.hxx +++ b/ucb/source/ucp/inc/urihelper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: urihelper.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/makefile.mk b/ucb/source/ucp/odma/makefile.mk index 290898e655e5..d9ddcbfdf01b 100644 --- a/ucb/source/ucp/odma/makefile.mk +++ b/ucb/source/ucp/odma/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_content.cxx b/ucb/source/ucp/odma/odma_content.cxx index ef6128a0b75b..ae3c3ede60e7 100644 --- a/ucb/source/ucp/odma/odma_content.cxx +++ b/ucb/source/ucp/odma/odma_content.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_content.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_content.hxx b/ucb/source/ucp/odma/odma_content.hxx index 8fa528450d37..30422a82e284 100644 --- a/ucb/source/ucp/odma/odma_content.hxx +++ b/ucb/source/ucp/odma/odma_content.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_content.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_contentcaps.cxx b/ucb/source/ucp/odma/odma_contentcaps.cxx index 9b54ed561ec3..8bc0b5cd51dc 100644 --- a/ucb/source/ucp/odma/odma_contentcaps.cxx +++ b/ucb/source/ucp/odma/odma_contentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_contentcaps.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_contentprops.hxx b/ucb/source/ucp/odma/odma_contentprops.hxx index a4649d744545..602c1d3d8354 100644 --- a/ucb/source/ucp/odma/odma_contentprops.hxx +++ b/ucb/source/ucp/odma/odma_contentprops.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_contentprops.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_datasupplier.cxx b/ucb/source/ucp/odma/odma_datasupplier.cxx index 68ee5f91cbae..aab2a3d8663c 100644 --- a/ucb/source/ucp/odma/odma_datasupplier.cxx +++ b/ucb/source/ucp/odma/odma_datasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_datasupplier.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_datasupplier.hxx b/ucb/source/ucp/odma/odma_datasupplier.hxx index c51bf79ee7ca..a37ecebf0e39 100644 --- a/ucb/source/ucp/odma/odma_datasupplier.hxx +++ b/ucb/source/ucp/odma/odma_datasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_datasupplier.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_inputstream.cxx b/ucb/source/ucp/odma/odma_inputstream.cxx index 8a9f2da2d0bf..65491c34829b 100644 --- a/ucb/source/ucp/odma/odma_inputstream.cxx +++ b/ucb/source/ucp/odma/odma_inputstream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_inputstream.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_inputstream.hxx b/ucb/source/ucp/odma/odma_inputstream.hxx index 0039d590f9f9..c751b81989b8 100644 --- a/ucb/source/ucp/odma/odma_inputstream.hxx +++ b/ucb/source/ucp/odma/odma_inputstream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_inputstream.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx index 1b825e84c497..774bcf5f6323 100644 --- a/ucb/source/ucp/odma/odma_lib.cxx +++ b/ucb/source/ucp/odma/odma_lib.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_lib.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_lib.hxx b/ucb/source/ucp/odma/odma_lib.hxx index 4f2c3b9e583d..f4229572dbab 100644 --- a/ucb/source/ucp/odma/odma_lib.hxx +++ b/ucb/source/ucp/odma/odma_lib.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_lib.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_main.cxx b/ucb/source/ucp/odma/odma_main.cxx index 893187a2a95c..3d7a22e907dd 100644 --- a/ucb/source/ucp/odma/odma_main.cxx +++ b/ucb/source/ucp/odma/odma_main.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_main.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_provider.cxx b/ucb/source/ucp/odma/odma_provider.cxx index 8f4b4603911d..6c4df4c40b88 100644 --- a/ucb/source/ucp/odma/odma_provider.cxx +++ b/ucb/source/ucp/odma/odma_provider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_provider.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_provider.hxx b/ucb/source/ucp/odma/odma_provider.hxx index 26a84eb25a02..0e861f59b492 100644 --- a/ucb/source/ucp/odma/odma_provider.hxx +++ b/ucb/source/ucp/odma/odma_provider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_provider.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_resultset.cxx b/ucb/source/ucp/odma/odma_resultset.cxx index 3329e99457bd..82e6b271fcd3 100644 --- a/ucb/source/ucp/odma/odma_resultset.cxx +++ b/ucb/source/ucp/odma/odma_resultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_resultset.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_resultset.hxx b/ucb/source/ucp/odma/odma_resultset.hxx index ad55b361bef3..77787b1fccda 100644 --- a/ucb/source/ucp/odma/odma_resultset.hxx +++ b/ucb/source/ucp/odma/odma_resultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_resultset.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/odma/odma_services.cxx b/ucb/source/ucp/odma/odma_services.cxx index 20ac86130dd2..3e4639e25806 100644 --- a/ucb/source/ucp/odma/odma_services.cxx +++ b/ucb/source/ucp/odma/odma_services.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: odma_services.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/makefile.mk b/ucb/source/ucp/package/makefile.mk index 4b4f066ac1cf..bd4707ccccc9 100644 --- a/ucb/source/ucp/package/makefile.mk +++ b/ucb/source/ucp/package/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.11 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx index f06618b702d3..8bdebb138467 100644 --- a/ucb/source/ucp/package/pkgcontent.cxx +++ b/ucb/source/ucp/package/pkgcontent.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgcontent.cxx,v $ - * $Revision: 1.59 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -55,9 +52,7 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> -#endif #include <com/sun/star/ucb/MissingInputStreamException.hpp> #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/ucb/NameClashException.hpp> @@ -105,17 +100,60 @@ ContentProperties::ContentProperties( const rtl::OUString& rContentType ) bEncrypted( sal_False ), bHasEncryptedEntries( sal_False ) { - bIsFolder = rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) ) - || rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) ); + bIsFolder = rContentType.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( PACKAGE_FOLDER_CONTENT_TYPE ) ) + || rContentType.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_FOLDER_CONTENT_TYPE ) ); bIsDocument = !bIsFolder; OSL_ENSURE( bIsFolder || - rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) ) || - rContentType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ), + rContentType.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( PACKAGE_STREAM_CONTENT_TYPE ) ) + || rContentType.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( PACKAGE_ZIP_STREAM_CONTENT_TYPE ) ), "ContentProperties::ContentProperties - Unknown type!" ); } //========================================================================= + +uno::Sequence< ucb::ContentInfo > +ContentProperties::getCreatableContentsInfo( PackageUri const & rUri ) const +{ + if ( bIsFolder ) + { + uno::Sequence< beans::Property > aProps( 1 ); + aProps.getArray()[ 0 ] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ); + + uno::Sequence< ucb::ContentInfo > aSeq( 2 ); + + // Folder. + aSeq.getArray()[ 0 ].Type + = Content::getContentType( rUri.getScheme(), sal_True ); + aSeq.getArray()[ 0 ].Attributes + = ucb::ContentInfoAttribute::KIND_FOLDER; + aSeq.getArray()[ 0 ].Properties = aProps; + + // Stream. + aSeq.getArray()[ 1 ].Type + = Content::getContentType( rUri.getScheme(), sal_False ); + aSeq.getArray()[ 1 ].Attributes + = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM + | ucb::ContentInfoAttribute::KIND_DOCUMENT; + aSeq.getArray()[ 1 ].Properties = aProps; + + return aSeq; + } + else + { + return uno::Sequence< ucb::ContentInfo >( 0 ); + } +} + +//========================================================================= //========================================================================= // // Content Implementation. @@ -166,9 +204,9 @@ Content* Content::create( ucb::ContentInfo aInfo; if ( bFolder || aURI.isRootFolder() ) - aInfo.Type = GetContentType( aURI.getScheme(), sal_True ); + aInfo.Type = getContentType( aURI.getScheme(), sal_True ); else - aInfo.Type = GetContentType( aURI.getScheme(), sal_False ); + aInfo.Type = getContentType( aURI.getScheme(), sal_False ); return new Content( rxSMgr, pProvider, xId, xPackage, aURI, aInfo ); } @@ -188,9 +226,9 @@ Content* Content::create( PackageUri aURI( Identifier->getContentIdentifier() ); if ( !Info.Type.equalsIgnoreAsciiCase( - GetContentType( aURI.getScheme(), sal_True ) ) && + getContentType( aURI.getScheme(), sal_True ) ) && !Info.Type.equalsIgnoreAsciiCase( - GetContentType( aURI.getScheme(), sal_False ) ) ) + getContentType( aURI.getScheme(), sal_False ) ) ) return 0; uno::Reference< container::XHierarchicalNameAccess > xPackage; @@ -210,7 +248,7 @@ Content* Content::create( //========================================================================= // static -::rtl::OUString Content::GetContentType( +::rtl::OUString Content::getContentType( const ::rtl::OUString& aScheme, sal_Bool bFolder ) { return ( rtl::OUString::createFromAscii( "application/" ) @@ -294,7 +332,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType ) aRet = cppu::queryInterface( rType, static_cast< ucb::XContentCreator * >( this ) ); - return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType ); + return aRet.hasValue() ? aRet : ContentImplHelper::queryInterface( rType ); } //========================================================================= @@ -609,7 +647,7 @@ uno::Any SAL_CALL Content::execute( { ////////////////////////////////////////////////////////////////// // transfer - // ( Not available at stream objects ) + // ( Not available at stream objects ) ////////////////////////////////////////////////////////////////// ucb::TransferInfo aInfo; @@ -628,11 +666,36 @@ uno::Any SAL_CALL Content::execute( transfer( aInfo, Environment ); } else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) && + isFolder() ) + { + ////////////////////////////////////////////////////////////////// + // createNewContent + // ( Not available at stream objects ) + ////////////////////////////////////////////////////////////////// + + ucb::ContentInfo aInfo; + if ( !( aCommand.Argument >>= aInfo ) ) + { + OSL_ENSURE( sal_False, "Wrong argument type!" ); + ucbhelper::cancelCommandExecution( + uno::makeAny( lang::IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >( this ), + -1 ) ), + Environment ); + // Unreachable + } + + aRet <<= createNewContent( aInfo ); + } + else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "flush" ) ) ) { ////////////////////////////////////////////////////////////////// // flush - // ( Not available at stream objects ) + // ( Not available at stream objects ) ////////////////////////////////////////////////////////////////// if( !flushData() ) @@ -693,43 +756,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() throw( uno::RuntimeException ) { - if ( isFolder() ) - { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - - uno::Sequence< beans::Property > aProps( 1 ); - aProps.getArray()[ 0 ] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - beans::PropertyAttribute::BOUND ); - - uno::Sequence< ucb::ContentInfo > aSeq( 2 ); - - // Folder. - aSeq.getArray()[ 0 ].Type - = GetContentType( m_aUri.getScheme(), sal_True ); - aSeq.getArray()[ 0 ].Attributes - = ucb::ContentInfoAttribute::KIND_FOLDER; - aSeq.getArray()[ 0 ].Properties = aProps; - - // Stream. - aSeq.getArray()[ 1 ].Type - = GetContentType( m_aUri.getScheme(), sal_False ); - aSeq.getArray()[ 1 ].Attributes - = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM - | ucb::ContentInfoAttribute::KIND_DOCUMENT; - aSeq.getArray()[ 1 ].Properties = aProps; - - return aSeq; - } - else - { - OSL_ENSURE( sal_False, - "queryCreatableContentsInfo called on non-folder object!" ); - - return uno::Sequence< ucb::ContentInfo >( 0 ); - } + return m_aProps.getCreatableContentsInfo( m_aUri ); } //========================================================================= @@ -746,16 +773,16 @@ Content::createNewContent( const ucb::ContentInfo& Info ) return uno::Reference< ucb::XContent >(); if ( !Info.Type.equalsIgnoreAsciiCase( - GetContentType( m_aUri.getScheme(), sal_True ) ) && + getContentType( m_aUri.getScheme(), sal_True ) ) && !Info.Type.equalsIgnoreAsciiCase( - GetContentType( m_aUri.getScheme(), sal_False ) ) ) + getContentType( m_aUri.getScheme(), sal_False ) ) ) return uno::Reference< ucb::XContent >(); rtl::OUString aURL = m_aUri.getUri(); aURL += rtl::OUString::createFromAscii( "/" ); if ( Info.Type.equalsIgnoreAsciiCase( - GetContentType( m_aUri.getScheme(), sal_True ) ) ) + getContentType( m_aUri.getScheme(), sal_True ) ) ) aURL += rtl::OUString::createFromAscii( "New_Folder" ); else aURL += rtl::OUString::createFromAscii( "New_Stream" ); @@ -871,6 +898,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( xRow->appendBoolean( rProp, rData.bIsFolder ); } else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + xRow->appendObject( + rProp, uno::makeAny( + rData.getCreatableContentsInfo( + PackageUri( rContentId ) ) ) ); + } + else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) ) { xRow->appendString ( rProp, rData.aMediaType ); @@ -978,6 +1013,16 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), rData.bIsFolder ); + xRow->appendObject( + beans::Property( + rtl::OUString::createFromAscii( "CreatableContentsInfo" ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ), + uno::makeAny( + rData.getCreatableContentsInfo( PackageUri( rContentId ) ) ) ); xRow->appendString( beans::Property( rtl::OUString::createFromAscii( "MediaType" ), @@ -1069,10 +1114,10 @@ uno::Sequence< uno::Any > Content::setPropertyValues( beans::PropertyChangeEvent aEvent; aEvent.Source = static_cast< cppu::OWeakObject * >( this ); aEvent.Further = sal_False; -// aEvent.PropertyName = +// aEvent.PropertyName = aEvent.PropertyHandle = -1; -// aEvent.OldValue = -// aEvent.NewValue = +// aEvent.OldValue = +// aEvent.NewValue = const beans::PropertyValue* pValues = rValues.getConstArray(); sal_Int32 nCount = rValues.getLength(); @@ -1116,6 +1161,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues( static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } + else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { if ( m_aUri.isRootFolder() ) @@ -1181,7 +1235,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aEvent.NewValue = uno::makeAny( aNewValue ); m_aProps.aMediaType = aNewValue; - nChanged++; + nChanged++; bStore = sal_True; m_nModifiedProps |= MEDIATYPE_MODIFIED; } @@ -1219,7 +1273,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aEvent.NewValue = uno::makeAny( bNewValue ); m_aProps.bCompressed = bNewValue; - nChanged++; + nChanged++; bStore = sal_True; m_nModifiedProps |= COMPRESSED_MODIFIED; } @@ -1256,7 +1310,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aEvent.NewValue = uno::makeAny( bNewValue ); m_aProps.bEncrypted = bNewValue; - nChanged++; + nChanged++; bStore = sal_True; m_nModifiedProps |= ENCRYPTED_MODIFIED; } @@ -1483,7 +1537,7 @@ uno::Any Content::open( uno::Reference< ucb::XDynamicResultSet > xSet = new DynamicResultSet( m_xSMgr, this, rArg, xEnv ); return uno::makeAny( xSet ); - } + } else { ////////////////////////////////////////////////////////////////// @@ -1506,7 +1560,7 @@ uno::Any Content::open( rtl::OUString aURL = m_xIdentifier->getContentIdentifier(); uno::Reference< io::XOutputStream > xOut( rArg.Sink, uno::UNO_QUERY ); if ( xOut.is() ) - { + { // PUSH: write data into xOut uno::Reference< io::XInputStream > xIn = getInputStream(); @@ -1560,14 +1614,14 @@ uno::Any Content::open( { // closeOutput, readSomeBytes, writeBytes } - } + } else - { + { uno::Reference< io::XActiveDataSink > xDataSink( rArg.Sink, uno::UNO_QUERY ); - if ( xDataSink.is() ) + if ( xDataSink.is() ) { - // PULL: wait for client read + // PULL: wait for client read uno::Reference< io::XInputStream > xIn = getInputStream(); if ( !xIn.is() ) @@ -1598,7 +1652,7 @@ uno::Any Content::open( // Done. xDataSink->setInputStream( xIn ); } - else + else { // Note: aOpenCommand.Sink may contain an XStream // implementation. Support for this type of @@ -1612,7 +1666,7 @@ uno::Any Content::open( xEnv ); // Unreachable } - } + } } return uno::Any(); @@ -1931,8 +1985,8 @@ void Content::transfer( ////////////////////////////////////////////////////////////////////// rtl::OUString aType = xSource->isFolder() - ? GetContentType( m_aUri.getScheme(), sal_True ) - : GetContentType( m_aUri.getScheme(), sal_False ); + ? getContentType( m_aUri.getScheme(), sal_True ) + : getContentType( m_aUri.getScheme(), sal_False ); ucb::ContentInfo aContentInfo; aContentInfo.Type = aType; aContentInfo.Attributes = 0; @@ -2413,14 +2467,14 @@ sal_Bool Content::loadData( if ( xEnumAccess.is() ) { // folder - rProps.aContentType = GetContentType( rURI.getScheme(), sal_True ); + rProps.aContentType = getContentType( rURI.getScheme(), sal_True ); rProps.bIsDocument = sal_False; rProps.bIsFolder = sal_True; } else { // stream - rProps.aContentType = GetContentType( rURI.getScheme(), sal_False ); + rProps.aContentType = getContentType( rURI.getScheme(), sal_False ); rProps.bIsDocument = sal_True; rProps.bIsFolder = sal_False; } @@ -2611,8 +2665,8 @@ sal_Bool Content::storeData( const uno::Reference< io::XInputStream >& xStream ) if ( !xNA->hasByHierarchicalName( m_aUri.getPath() ) ) { -// if ( !bCreate ) -// return sal_True; +// if ( !bCreate ) +// return sal_True; try { @@ -2956,4 +3010,3 @@ uno::Reference< container::XEnumeration > Content::getIterator() return xIter; } - diff --git a/ucb/source/ucp/package/pkgcontent.hxx b/ucb/source/ucp/package/pkgcontent.hxx index f542fb0b8222..5dbc8a69c1de 100644 --- a/ucb/source/ucp/package/pkgcontent.hxx +++ b/ucb/source/ucp/package/pkgcontent.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgcontent.hxx,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -34,9 +31,7 @@ #include <list> #include <rtl/ref.hxx> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> -#endif #include <com/sun/star/ucb/XContentCreator.hpp> #include <ucbhelper/contenthelper.hxx> #include "pkguri.hxx" @@ -100,6 +95,9 @@ struct ContentProperties bHasEncryptedEntries( sal_False ) {} ContentProperties( const ::rtl::OUString& rContentType ); + + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + getCreatableContentsInfo( PackageUri const & rUri ) const; }; //========================================================================= @@ -110,7 +108,7 @@ class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator { enum ContentState { TRANSIENT, // created via CreateNewContent, - // but did not process "insert" yet + // but did not process "insert" yet PERSISTENT, // processed "insert" DEAD // processed "delete" }; @@ -119,7 +117,7 @@ class Content : public ::ucbhelper::ContentImplHelper, ContentProperties m_aProps; ContentState m_eState; com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > m_xPackage; + com::sun::star::container::XHierarchicalNameAccess > m_xPackage; ContentProvider* m_pProvider; sal_uInt32 m_nModifiedProps; @@ -130,7 +128,7 @@ private: const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier, const ::com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess >& Package, + com::sun::star::container::XHierarchicalNameAccess >& Package, const PackageUri& rUri, const ContentProperties& rProps ); Content( const com::sun::star::uno::Reference< @@ -139,7 +137,7 @@ private: const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& Identifier, const com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess >& Package, + com::sun::star::container::XHierarchicalNameAccess >& Package, const PackageUri& rUri, const com::sun::star::ucb::ContentInfo& Info ); @@ -155,7 +153,7 @@ private: getPropertyValues( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties, + ::com::sun::star::beans::Property >& rProperties, const ContentProperties& rData, const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >& rProvider, @@ -183,24 +181,20 @@ private: const PackageUri& rURI, ContentProperties& rProps, com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > & + com::sun::star::container::XHierarchicalNameAccess > & rxPackage ); static sal_Bool hasData( ContentProvider* pProvider, const PackageUri& rURI, com::sun::star::uno::Reference< - com::sun::star::container::XHierarchicalNameAccess > & + com::sun::star::container::XHierarchicalNameAccess > & rxPackage ); - static ::rtl::OUString - GetContentType( const ::rtl::OUString& aScheme, - sal_Bool bFolder ); - sal_Bool hasData( const PackageUri& rURI ); sal_Bool renameData( const com::sun::star::uno::Reference< - com::sun::star::ucb::XContentIdentifier >& xOldId, + com::sun::star::ucb::XContentIdentifier >& xOldId, const com::sun::star::uno::Reference< com::sun::star::ucb::XContentIdentifier >& xNewId ); sal_Bool @@ -223,7 +217,7 @@ private: ::com::sun::star::uno::Any open( const ::com::sun::star::ucb::OpenCommandArgument2& rArg, const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment > & xEnv ) + ::com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw( ::com::sun::star::uno::Exception ); void insert( const ::com::sun::star::uno::Reference< @@ -292,7 +286,7 @@ public: execute( const com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException ); @@ -323,7 +317,7 @@ public: getPropertyValues( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties, + ::com::sun::star::beans::Property >& rProperties, ContentProvider* pProvider, const ::rtl::OUString& rContentId ); @@ -331,6 +325,9 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > getIterator(); + + static ::rtl::OUString + getContentType( const ::rtl::OUString& aScheme, sal_Bool bFolder ); }; } diff --git a/ucb/source/ucp/package/pkgcontentcaps.cxx b/ucb/source/ucp/package/pkgcontentcaps.cxx index 0538d93f8702..88807d900275 100644 --- a/ucb/source/ucp/package/pkgcontentcaps.cxx +++ b/ucb/source/ucp/package/pkgcontentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgcontentcaps.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -45,6 +42,7 @@ MediaType (w) (w) w Title r w w Size - - r + CreatableContentsInfo r r r Compressed - - w Encrypted - - w HasEncryptedEntries r - - @@ -58,6 +56,7 @@ open x x x transfer x x - flush x x - + createNewContent x x - *************************************************************************/ #include <com/sun/star/beans/Property.hpp> @@ -78,6 +77,12 @@ using namespace package_ucp; // //========================================================================= +#define MAKEPROPSEQUENCE( a ) \ + uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + +#define MAKECMDSEQUENCE( a ) \ + uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + //========================================================================= // // IMPORTENT: If any property data ( name / type / ... ) are changed, then @@ -145,6 +150,15 @@ uno::Sequence< beans::Property > Content::getProperties( getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ), /////////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////////// @@ -157,8 +171,7 @@ uno::Sequence< beans::Property > Content::getProperties( | beans::PropertyAttribute::READONLY ) }; - return uno::Sequence< beans::Property >( - aRootFolderPropertyInfoTable, 6 ); + return MAKEPROPSEQUENCE( aRootFolderPropertyInfoTable ); } else { @@ -210,13 +223,21 @@ uno::Sequence< beans::Property > Content::getProperties( -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND + ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) /////////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////////// }; - return uno::Sequence< beans::Property >( - aFolderPropertyInfoTable, 5 ); + return MAKEPROPSEQUENCE( aFolderPropertyInfoTable ); } } else @@ -275,6 +296,15 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ), /////////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////////// @@ -291,7 +321,7 @@ uno::Sequence< beans::Property > Content::getProperties( beans::PropertyAttribute::BOUND ) }; - return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 8 ); + return MAKEPROPSEQUENCE( aStreamPropertyInfoTable ); } } @@ -360,6 +390,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) + ), /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// @@ -370,8 +406,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( ) }; - return uno::Sequence< - ucb::CommandInfo >( aRootFolderCommandInfoTable, 7 ); + return MAKECMDSEQUENCE( aRootFolderCommandInfoTable ); } else { @@ -439,6 +474,12 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) + ), /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// @@ -449,8 +490,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( ) }; - return uno::Sequence< - ucb::CommandInfo >( aFolderCommandInfoTable, 9 ); + return MAKECMDSEQUENCE( aFolderCommandInfoTable ); } } else @@ -517,8 +557,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( /////////////////////////////////////////////////////////////// }; - return uno::Sequence< ucb::CommandInfo >( - aStreamCommandInfoTable, 7 ); + return MAKECMDSEQUENCE( aStreamCommandInfoTable ); } } - diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx b/ucb/source/ucp/package/pkgdatasupplier.cxx index 6f7b9a5b2d57..133e16dc7ed8 100644 --- a/ucb/source/ucp/package/pkgdatasupplier.cxx +++ b/ucb/source/ucp/package/pkgdatasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgdatasupplier.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgdatasupplier.hxx b/ucb/source/ucp/package/pkgdatasupplier.hxx index c759fd09c193..2342becad8eb 100644 --- a/ucb/source/ucp/package/pkgdatasupplier.hxx +++ b/ucb/source/ucp/package/pkgdatasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgdatasupplier.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index 5fa0d402a59b..92c35fe78bb9 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgprovider.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgprovider.hxx b/ucb/source/ucp/package/pkgprovider.hxx index e39934129f90..89843f192cc1 100644 --- a/ucb/source/ucp/package/pkgprovider.hxx +++ b/ucb/source/ucp/package/pkgprovider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgprovider.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgresultset.cxx b/ucb/source/ucp/package/pkgresultset.cxx index ac97cb8f3ecb..076e7aa69132 100644 --- a/ucb/source/ucp/package/pkgresultset.cxx +++ b/ucb/source/ucp/package/pkgresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgresultset.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgresultset.hxx b/ucb/source/ucp/package/pkgresultset.hxx index d0c7ad54642c..43621f8adf90 100644 --- a/ucb/source/ucp/package/pkgresultset.hxx +++ b/ucb/source/ucp/package/pkgresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgresultset.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkgservices.cxx b/ucb/source/ucp/package/pkgservices.cxx index 27a277259471..251ce8c78dd1 100644 --- a/ucb/source/ucp/package/pkgservices.cxx +++ b/ucb/source/ucp/package/pkgservices.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkgservices.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx index 535f5961b979..feb8daec7905 100644 --- a/ucb/source/ucp/package/pkguri.cxx +++ b/ucb/source/ucp/package/pkguri.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkguri.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/package/pkguri.hxx b/ucb/source/ucp/package/pkguri.hxx index f7e9a3365764..68513bcfa940 100644 --- a/ucb/source/ucp/package/pkguri.hxx +++ b/ucb/source/ucp/package/pkguri.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: pkguri.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/makefile.mk b/ucb/source/ucp/tdoc/makefile.mk index 1c2c44b124de..2c85514ef91f 100644 --- a/ucb/source/ucp/tdoc/makefile.mk +++ b/ucb/source/ucp/tdoc/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.10 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_content.cxx b/ucb/source/ucp/tdoc/tdoc_content.cxx index 908d7310889b..2c2103e46224 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.cxx +++ b/ucb/source/ucp/tdoc/tdoc_content.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_content.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -226,7 +223,7 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType ) rType, static_cast< ucb::XContentCreator * >( this ) ); if ( aRet.hasValue() ) { - if ( !isContentCreator() ) + if ( !m_aProps.isContentCreator() ) return uno::Any(); } } @@ -249,7 +246,7 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes() { cppu::OTypeCollection * pCollection = 0; - if ( isContentCreator() ) + if ( m_aProps.isContentCreator() ) { static cppu::OTypeCollection* pFolderTypes = 0; @@ -660,6 +657,49 @@ uno::Any SAL_CALL Content::execute( transfer( aInfo, Environment ); } + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) ) + { + ////////////////////////////////////////////////////////////////// + // createNewContent ( Supported by document and folders only ) + ////////////////////////////////////////////////////////////////// + + { + osl::MutexGuard aGuard( m_aMutex ); + + ContentType eType = m_aProps.getType(); + if ( ( eType != FOLDER ) && ( eType != DOCUMENT ) ) + { + ucbhelper::cancelCommandExecution( + uno::makeAny( ucb::UnsupportedCommandException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "createNewContent command only " + "supported by folders and " + "documents!" ) ), + static_cast< cppu::OWeakObject * >( + this ) ) ), + Environment ); + // Unreachable + } + } + + ucb::ContentInfo aInfo; + if ( !( aCommand.Argument >>= aInfo ) ) + { + OSL_ENSURE( sal_False, "Wrong argument type!" ); + ucbhelper::cancelCommandExecution( + uno::makeAny( lang::IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >( this ), + -1 ) ), + Environment ); + // Unreachable + } + + aRet <<= createNewContent( aInfo ); + } else { ////////////////////////////////////////////////////////////////// @@ -695,65 +735,7 @@ uno::Sequence< ucb::ContentInfo > SAL_CALL Content::queryCreatableContentsInfo() throw( uno::RuntimeException ) { - if ( isContentCreator() ) - { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - - uno::Sequence< beans::Property > aProps( 1 ); - aProps.getArray()[ 0 ] = beans::Property( - rtl::OUString::createFromAscii( "Title" ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - beans::PropertyAttribute::BOUND ); - -#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT - if ( m_aProps.getType() == DOCUMENT ) - { - // streams cannot be created as direct children of document root - uno::Sequence< ucb::ContentInfo > aSeq( 1 ); - - // Folder. - aSeq.getArray()[ 0 ].Type - = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE ); - aSeq.getArray()[ 0 ].Attributes - = ucb::ContentInfoAttribute::KIND_FOLDER; - aSeq.getArray()[ 0 ].Properties = aProps; - - return aSeq; - } - else - { -#endif - uno::Sequence< ucb::ContentInfo > aSeq( 2 ); - - // Folder. - aSeq.getArray()[ 0 ].Type - = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE ); - aSeq.getArray()[ 0 ].Attributes - = ucb::ContentInfoAttribute::KIND_FOLDER; - aSeq.getArray()[ 0 ].Properties = aProps; - - // Stream. - aSeq.getArray()[ 1 ].Type - = rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE ); - aSeq.getArray()[ 1 ].Attributes - = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM - | ucb::ContentInfoAttribute::KIND_DOCUMENT; - aSeq.getArray()[ 1 ].Properties = aProps; - - return aSeq; -#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT - } -#endif - } - else - { - OSL_ENSURE( sal_False, - "queryCreatableContentsInfo called on non-contentcreator " - "object!" ); - - return uno::Sequence< ucb::ContentInfo >( 0 ); - } + return m_aProps.getCreatableContentsInfo(); } //========================================================================= @@ -762,7 +744,7 @@ uno::Reference< ucb::XContent > SAL_CALL Content::createNewContent( const ucb::ContentInfo& Info ) throw( uno::RuntimeException ) { - if ( isContentCreator() ) + if ( m_aProps.isContentCreator() ) { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -1061,6 +1043,12 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( xRow->appendBoolean( rProp, rData.getIsFolder() ); } else if ( rProp.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + xRow->appendObject( + rProp, uno::makeAny( rData.getCreatableContentsInfo() ) ); + } + else if ( rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Storage" ) ) ) { // Storage is only supported by folders. @@ -1155,6 +1143,15 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ), rData.getIsFolder() ); + xRow->appendObject( + beans::Property( + rtl::OUString::createFromAscii( "CreatableContentsInfo" ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ), + uno::makeAny( rData.getCreatableContentsInfo() ) ); // Storage is only supported by folders. if ( eType == FOLDER ) @@ -1219,10 +1216,10 @@ uno::Sequence< uno::Any > Content::setPropertyValues( beans::PropertyChangeEvent aEvent; aEvent.Source = static_cast< cppu::OWeakObject * >( this ); aEvent.Further = sal_False; -// aEvent.PropertyName = + // aEvent.PropertyName = aEvent.PropertyHandle = -1; -// aEvent.OldValue = -// aEvent.NewValue = + // aEvent.OldValue = + // aEvent.NewValue = const beans::PropertyValue* pValues = rValues.getConstArray(); sal_Int32 nCount = rValues.getLength(); @@ -1266,6 +1263,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues( static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } + else if ( rValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Title" ) ) ) { // Title is read-only for root and documents. @@ -2370,14 +2376,6 @@ void Content::transfer( } //========================================================================= -bool Content::isContentCreator() -{ - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - return - ( m_aProps.getType() == FOLDER ) || ( m_aProps.getType() == DOCUMENT ); -} - -//========================================================================= //static bool Content::hasData( ContentProvider* pProvider, const Uri & rUri ) { @@ -3059,3 +3057,79 @@ uno::Reference< io::XStream > Content::getStream( } } } + +//========================================================================= +//========================================================================= +// +// ContentProperties Implementation. +// +//========================================================================= +//========================================================================= + +uno::Sequence< ucb::ContentInfo > +ContentProperties::getCreatableContentsInfo() const +{ + if ( isContentCreator() ) + { + uno::Sequence< beans::Property > aProps( 1 ); + aProps.getArray()[ 0 ] = beans::Property( + rtl::OUString::createFromAscii( "Title" ), + -1, + getCppuType( static_cast< const rtl::OUString * >( 0 ) ), + beans::PropertyAttribute::BOUND ); + +#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT + if ( getType() == DOCUMENT ) + { + // streams cannot be created as direct children of document root + uno::Sequence< ucb::ContentInfo > aSeq( 1 ); + + // Folder. + aSeq.getArray()[ 0 ].Type + = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE ); + aSeq.getArray()[ 0 ].Attributes + = ucb::ContentInfoAttribute::KIND_FOLDER; + aSeq.getArray()[ 0 ].Properties = aProps; + + return aSeq; + } + else + { +#endif + uno::Sequence< ucb::ContentInfo > aSeq( 2 ); + + // Folder. + aSeq.getArray()[ 0 ].Type + = rtl::OUString::createFromAscii( TDOC_FOLDER_CONTENT_TYPE ); + aSeq.getArray()[ 0 ].Attributes + = ucb::ContentInfoAttribute::KIND_FOLDER; + aSeq.getArray()[ 0 ].Properties = aProps; + + // Stream. + aSeq.getArray()[ 1 ].Type + = rtl::OUString::createFromAscii( TDOC_STREAM_CONTENT_TYPE ); + aSeq.getArray()[ 1 ].Attributes + = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM + | ucb::ContentInfoAttribute::KIND_DOCUMENT; + aSeq.getArray()[ 1 ].Properties = aProps; + + return aSeq; +#ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT + } +#endif + } + else + { + OSL_ENSURE( sal_False, + "getCreatableContentsInfo called on non-contentcreator " + "object!" ); + + return uno::Sequence< ucb::ContentInfo >( 0 ); + } +} + +//========================================================================= +bool ContentProperties::isContentCreator() const +{ + return ( getType() == FOLDER ) || ( getType() == DOCUMENT ); +} diff --git a/ucb/source/ucp/tdoc/tdoc_content.hxx b/ucb/source/ucp/tdoc/tdoc_content.hxx index c1ff14928496..b3a3270292be 100644 --- a/ucb/source/ucp/tdoc/tdoc_content.hxx +++ b/ucb/source/ucp/tdoc/tdoc_content.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_content.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -43,7 +40,8 @@ namespace com { namespace sun { namespace star { namespace sdbc { class XRow; } namespace io { class XInputStream; class XOutputStream; } namespace beans { struct PropertyValue; } - namespace ucb { struct OpenCommandArgument2; struct TransferInfo; } + namespace ucb { struct OpenCommandArgument2; struct TransferInfo; + struct ContentInfo; } } } } namespace tdoc_ucp @@ -94,6 +92,11 @@ public: const rtl::OUString & getTitle() const { return m_aTitle; } void setTitle( const rtl::OUString & rTitle ) { m_aTitle = rTitle; } + com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > + getCreatableContentsInfo() const; + + bool isContentCreator() const; + private: ContentType m_eType; rtl::OUString m_aContentType; @@ -106,7 +109,7 @@ class Content : public ::ucbhelper::ContentImplHelper, public com::sun::star::ucb::XContentCreator { enum ContentState { TRANSIENT, // created via createNewContent, - // but did not process "insert" yet + // but did not process "insert" yet PERSISTENT, // processed "insert" DEAD // processed "delete" / document was closed }; @@ -137,8 +140,6 @@ private: com::sun::star::ucb::XCommandEnvironment > & xEnv ); virtual ::rtl::OUString getParentURL(); - bool isContentCreator(); - static bool hasData( ContentProvider* pProvider, const Uri & rUri ); bool hasData( const Uri & rUri ) { return hasData( m_pProvider, rUri ); } @@ -173,7 +174,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > getPropertyValues( const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties ); + ::com::sun::star::beans::Property >& rProperties ); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > setPropertyValues( const ::com::sun::star::uno::Sequence< @@ -294,7 +295,7 @@ public: execute( const com::sun::star::ucb::Command& aCommand, sal_Int32 CommandId, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( com::sun::star::uno::Exception, com::sun::star::ucb::CommandAbortedException, com::sun::star::uno::RuntimeException ); diff --git a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx index 792d693ab194..d8c89c351c89 100644 --- a/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx +++ b/ucb/source/ucp/tdoc/tdoc_contentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_contentcaps.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -46,6 +43,7 @@ IsDocument r r r r r r IsFolder r r r r r r Title r r w w w w + CreatableContentsInfo r r r r r r Storage - - r r - - DocumentModel - r - - - - @@ -57,6 +55,7 @@ delete - - x - x - open x x x - x - transfer - x x - - - + createNewContent - x x - - - #ifdef NO_STREAM_CREATION_WITHIN_DOCUMENT_ROOT (*) not supported by streams that are direct children of document @@ -88,6 +87,12 @@ using namespace tdoc_ucp; // //========================================================================= +#define MAKEPROPSEQUENCE( a ) \ + uno::Sequence< beans::Property >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + +#define MAKECMDSEQUENCE( a ) \ + uno::Sequence< ucb::CommandInfo >( a, sizeof( a ) / sizeof( a[ 0 ] ) ) + //========================================================================= // // IMPORTENT: If any property data ( name / type / ... ) are changed, then @@ -142,15 +147,24 @@ uno::Sequence< beans::Property > Content::getProperties( -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND - ) + ), /////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ) /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// }; - return uno::Sequence< beans::Property >( aStreamPropertyInfoTable, 4 ); + return MAKEPROPSEQUENCE( aStreamPropertyInfoTable ); } else if ( m_aProps.getType() == FOLDER ) { @@ -197,6 +211,15 @@ uno::Sequence< beans::Property > Content::getProperties( /////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ), /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// @@ -209,7 +232,7 @@ uno::Sequence< beans::Property > Content::getProperties( | beans::PropertyAttribute::READONLY ) }; - return uno::Sequence< beans::Property >( aFolderPropertyInfoTable, 5 ); + return MAKEPROPSEQUENCE( aFolderPropertyInfoTable ); } else if ( m_aProps.getType() == DOCUMENT ) { @@ -257,6 +280,15 @@ uno::Sequence< beans::Property > Content::getProperties( /////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ), /////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////// @@ -269,7 +301,7 @@ uno::Sequence< beans::Property > Content::getProperties( | beans::PropertyAttribute::READONLY ) }; - return uno::Sequence< beans::Property >( aDocPropertyInfoTable, 5 ); + return MAKEPROPSEQUENCE( aDocPropertyInfoTable ); } else { @@ -313,15 +345,24 @@ uno::Sequence< beans::Property > Content::getProperties( getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY - ) + ), /////////////////////////////////////////////////////////////// // Optional standard properties /////////////////////////////////////////////////////////////// + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY + ) /////////////////////////////////////////////////////////////// // New properties /////////////////////////////////////////////////////////////// }; - return uno::Sequence< beans::Property >( aRootPropertyInfoTable, 4 ); + return MAKEPROPSEQUENCE( aRootPropertyInfoTable ); } } @@ -396,8 +437,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aStreamCommandInfoTable1, 6 ); + return MAKECMDSEQUENCE( aStreamCommandInfoTable1 ); } #endif //================================================================= @@ -461,8 +501,7 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aStreamCommandInfoTable, 7 ); + return MAKECMDSEQUENCE( aStreamCommandInfoTable ); } else if ( m_aProps.getType() == FOLDER ) { @@ -527,13 +566,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), -1, getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) + ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ) /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aFolderCommandInfoTable, 8 ); + return MAKECMDSEQUENCE( aFolderCommandInfoTable ); } else if ( m_aProps.getType() == DOCUMENT ) { @@ -588,13 +632,18 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), -1, getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) + ), + ucb::CommandInfo( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "createNewContent" ) ), + -1, + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ) /////////////////////////////////////////////////////////// // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aDocCommandInfoTable, 6 ); + return MAKECMDSEQUENCE( aDocCommandInfoTable ); } else { @@ -651,7 +700,6 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( // New commands /////////////////////////////////////////////////////////// }; - return uno::Sequence< - ucb::CommandInfo >( aRootCommandInfoTable, 5 ); + return MAKECMDSEQUENCE( aRootCommandInfoTable ); } } diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx index e96e00d6bc6e..c9931c872b16 100644 --- a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx +++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_datasupplier.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx b/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx index 5119ac706629..28d9a4eba9a2 100644 --- a/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx +++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_datasupplier.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx index 51bc2ba2cb94..46aa1ae69ec3 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_docmgr.cxx,v $ - * $Revision: 1.19.24.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx index b0d420cbe6f8..8f8b2fc117f0 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_docmgr.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx index b455e5834bd2..72c5f700aa2c 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_documentcontentfactory.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx index 44a01efde938..7a2d919e5708 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_documentcontentfactory.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx index 65f75f5a8a67..c7ce1b893372 100644 --- a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx +++ b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_passwordrequest.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_passwordrequest.hxx b/ucb/source/ucp/tdoc/tdoc_passwordrequest.hxx index 441c0a3145c7..bc170bece65b 100644 --- a/ucb/source/ucp/tdoc/tdoc_passwordrequest.hxx +++ b/ucb/source/ucp/tdoc/tdoc_passwordrequest.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_passwordrequest.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index 1ee6a4ee5160..7ffedfcf1932 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_provider.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx index 28e60757216e..70f61e130980 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.hxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_provider.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_resultset.cxx b/ucb/source/ucp/tdoc/tdoc_resultset.cxx index e2c3053514ce..d8212fa028bb 100644 --- a/ucb/source/ucp/tdoc/tdoc_resultset.cxx +++ b/ucb/source/ucp/tdoc/tdoc_resultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_resultset.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_resultset.hxx b/ucb/source/ucp/tdoc/tdoc_resultset.hxx index f177402cb692..a3e420894ade 100644 --- a/ucb/source/ucp/tdoc/tdoc_resultset.hxx +++ b/ucb/source/ucp/tdoc/tdoc_resultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_resultset.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_services.cxx b/ucb/source/ucp/tdoc/tdoc_services.cxx index 3ab332323b64..6f9641d5159b 100644 --- a/ucb/source/ucp/tdoc/tdoc_services.cxx +++ b/ucb/source/ucp/tdoc/tdoc_services.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_services.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_stgelems.cxx b/ucb/source/ucp/tdoc/tdoc_stgelems.cxx index 359736916222..0bd25f94d096 100644 --- a/ucb/source/ucp/tdoc/tdoc_stgelems.cxx +++ b/ucb/source/ucp/tdoc/tdoc_stgelems.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_stgelems.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_stgelems.hxx b/ucb/source/ucp/tdoc/tdoc_stgelems.hxx index 7be8b3f1a878..9afa15abf994 100644 --- a/ucb/source/ucp/tdoc/tdoc_stgelems.hxx +++ b/ucb/source/ucp/tdoc/tdoc_stgelems.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_stgelems.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx index 689fe80124da..8deb942900a8 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.cxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_storage.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_storage.hxx b/ucb/source/ucp/tdoc/tdoc_storage.hxx index 612bfba967bd..39a95a5a7fe8 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.hxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_storage.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_uri.cxx b/ucb/source/ucp/tdoc/tdoc_uri.cxx index d829490dec23..712ced2d04f1 100644 --- a/ucb/source/ucp/tdoc/tdoc_uri.cxx +++ b/ucb/source/ucp/tdoc/tdoc_uri.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_uri.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/tdoc/tdoc_uri.hxx b/ucb/source/ucp/tdoc/tdoc_uri.hxx index 26c66d5e8d2f..5f251cc55bee 100644 --- a/ucb/source/ucp/tdoc/tdoc_uri.hxx +++ b/ucb/source/ucp/tdoc/tdoc_uri.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tdoc_uri.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/ContentProperties.cxx b/ucb/source/ucp/webdav/ContentProperties.cxx index 2371506f0d78..2285ad28a888 100644 --- a/ucb/source/ucp/webdav/ContentProperties.cxx +++ b/ucb/source/ucp/webdav/ContentProperties.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ContentProperties.cxx,v $ - * $Revision: 1.12.18.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/ContentProperties.hxx b/ucb/source/ucp/webdav/ContentProperties.hxx index 47e1ff57e3ec..7819698bf667 100644 --- a/ucb/source/ucp/webdav/ContentProperties.hxx +++ b/ucb/source/ucp/webdav/ContentProperties.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ContentProperties.hxx,v $ - * $Revision: 1.12.34.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVAuthListener.hxx b/ucb/source/ucp/webdav/DAVAuthListener.hxx index 548a4a0a97fa..c092f9fd311f 100644 --- a/ucb/source/ucp/webdav/DAVAuthListener.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVAuthListener.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx index db06b24b22bc..3d03cc63952b 100644 --- a/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx +++ b/ucb/source/ucp/webdav/DAVAuthListenerImpl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVAuthListenerImpl.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVException.hxx b/ucb/source/ucp/webdav/DAVException.hxx index 8e87ab2f2a36..c981eb404676 100644 --- a/ucb/source/ucp/webdav/DAVException.hxx +++ b/ucb/source/ucp/webdav/DAVException.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVException.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -108,17 +105,37 @@ class DAVException { public: enum ExceptionCode { - DAV_HTTP_ERROR = 0, // Generic error, mData = error message - DAV_HTTP_LOOKUP, // Name lookup failed, mData = server[:port] - DAV_HTTP_AUTH, // User authentication failed on server - DAV_HTTP_AUTHPROXY, // User authentication failed on proxy - DAV_HTTP_CONNECT, // Could not connect to server, mData = server[:port] + DAV_HTTP_ERROR = 0, // Generic error, + // mData = server error message, + // mStatusCode = HTTP status code + DAV_HTTP_LOOKUP, // Name lookup failed, + // mData = server[:port] + DAV_HTTP_AUTH, // User authentication failed on server, + // mData = server[:port] + DAV_HTTP_AUTHPROXY, // User authentication failed on proxy, + // mData = proxy server[:port] + DAV_HTTP_CONNECT, // Could not connect to server, + // mData = server[:port] DAV_HTTP_TIMEOUT, // Connection timed out + // mData = server[:port] DAV_HTTP_FAILED, // The precondition failed + // mData = server[:port] DAV_HTTP_RETRY, // Retry request - DAV_HTTP_REDIRECT, // See http_redirect.h, mData = new URL - DAV_SESSION_CREATE, // session creation error, mData = server[:port] - DAV_INVALID_ARG }; // mData = file URL + // mData = server[:port] + DAV_HTTP_REDIRECT, // Request was redirected, + // mData = new URL + DAV_SESSION_CREATE, // session creation error, + // mData = server[:port] + DAV_INVALID_ARG, // invalid argument + + DAV_LOCK_EXPIRED, // DAV lock expired + + DAV_NOT_LOCKED, // not locked + + DAV_LOCKED_SELF, // locked by this OOo session + + DAV_LOCKED // locked by third party + }; private: ExceptionCode mExceptionCode; diff --git a/ucb/source/ucp/webdav/DAVProperties.cxx b/ucb/source/ucp/webdav/DAVProperties.cxx index 2f11c2ee02c0..1202fb75a59f 100644 --- a/ucb/source/ucp/webdav/DAVProperties.cxx +++ b/ucb/source/ucp/webdav/DAVProperties.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVProperties.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -137,6 +134,26 @@ void DAVProperties::createUCBPropName( const char * nspace, rtl::OUString aName = rtl::OStringToOUString( name, RTL_TEXTENCODING_UTF8 ); + if ( !aNameSpace.getLength() ) + { + // Some servers send XML without proper namespaces. Assume "DAV:" + // in this case, if name is a well-known dav property name. + // Although this is not 100% correct, it solves many problems. + + if ( DAVProperties::RESOURCETYPE.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::SUPPORTEDLOCK.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::LOCKDISCOVERY.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::CREATIONDATE.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::DISPLAYNAME.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::GETCONTENTLANGUAGE.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::GETCONTENTLENGTH.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::GETCONTENTTYPE.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::GETETAG.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::GETLASTMODIFIED.matchIgnoreAsciiCase( aName, 4 ) || + DAVProperties::SOURCE.matchIgnoreAsciiCase( aName, 4 ) ) + aNameSpace = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DAV:" ) ); + } + // Note: Concatenating strings BEFORE comparing against known namespaces // is important. See RFC 2815 ( 23.4.2 Meaning of Qualified Names ). rFullName = aNameSpace; @@ -175,6 +192,8 @@ void DAVProperties::createUCBPropName( const char * nspace, // static bool DAVProperties::isUCBDeadProperty( const NeonPropName & rName ) { - return ( rtl_str_compareIgnoreAsciiCase( - rName.nspace, "http://ucb.openoffice.org/dav/props/" ) == 0 ); + return ( rName.nspace && + ( rtl_str_compareIgnoreAsciiCase( + rName.nspace, "http://ucb.openoffice.org/dav/props/" ) + == 0 ) ); } diff --git a/ucb/source/ucp/webdav/DAVProperties.hxx b/ucb/source/ucp/webdav/DAVProperties.hxx index 46642b39347d..46effc84697c 100644 --- a/ucb/source/ucp/webdav/DAVProperties.hxx +++ b/ucb/source/ucp/webdav/DAVProperties.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVProperties.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx index 59dfe01c3076..96e3faaff62f 100644 --- a/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx +++ b/ucb/source/ucp/webdav/DAVRequestEnvironment.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVRequestEnvironment.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVResource.hxx b/ucb/source/ucp/webdav/DAVResource.hxx index d67929001a8f..4a14dc262443 100644 --- a/ucb/source/ucp/webdav/DAVResource.hxx +++ b/ucb/source/ucp/webdav/DAVResource.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVResource.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index 140b3dd3af94..ea1c09efaa3f 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVResourceAccess.cxx,v $ - * $Revision: 1.29.16.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -67,6 +64,7 @@ int DAVAuthListener_Impl::authenticate( { uno::Reference< task::XInteractionHandler > xIH = m_xEnv->getInteractionHandler(); + if ( xIH.is() ) { // #102871# - Supply username and password from previous try. @@ -78,14 +76,10 @@ int DAVAuthListener_Impl::authenticate( outPassWord = m_aPrevPassword; rtl::Reference< ucbhelper::SimpleAuthenticationRequest > xRequest - = new ucbhelper::SimpleAuthenticationRequest( m_aURL, - inHostName, - inRealm, - inoutUserName, - outPassWord, - ::rtl::OUString(), - bAllowPersistentStoring, - bCanUseSystemCredentials ); + = new ucbhelper::SimpleAuthenticationRequest( + m_aURL, inHostName, inRealm, inoutUserName, + outPassWord, ::rtl::OUString(), + bAllowPersistentStoring, bCanUseSystemCredentials ); xIH->handle( xRequest.get() ); rtl::Reference< ucbhelper::InteractionContinuation > xSelection @@ -105,7 +99,8 @@ int DAVAuthListener_Impl::authenticate( sal_Bool bUseSystemCredentials = sal_False; if ( bCanUseSystemCredentials ) - bUseSystemCredentials = xSupp->getUseSystemCredentials(); + bUseSystemCredentials + = xSupp->getUseSystemCredentials(); if ( bUseSystemCredentials ) { @@ -178,6 +173,7 @@ DAVResourceAccess & DAVResourceAccess::operator=( return *this; } +#if 0 // currently not used, but please don't remove code //========================================================================= void DAVResourceAccess::OPTIONS( DAVCapabilities & rCapabilities, @@ -217,6 +213,7 @@ void DAVResourceAccess::OPTIONS( } while ( bRetry ); } +#endif //========================================================================= void DAVResourceAccess::PROPFIND( @@ -353,6 +350,7 @@ void DAVResourceAccess::HEAD( throw( DAVException ) { initialize(); + int errorCount = 0; bool bRetry; do @@ -409,7 +407,8 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( xStream = m_xSession->GET( getRequestURI(), DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv, m_aURL ), + new DAVAuthListener_Impl( + xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -492,7 +491,8 @@ uno::Reference< io::XInputStream > DAVResourceAccess::GET( rResource, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv, m_aURL ), + new DAVAuthListener_Impl( + xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -552,13 +552,15 @@ void DAVResourceAccess::GET( } //========================================================================= -void DAVResourceAccess::ABORT() +void DAVResourceAccess::abort() throw( DAVException ) { - // 17.11.09 (tkr): abort currently disabled caused by issue i106766 - // initialize(); - // m_xSession->ABORT(); + // 17.11.09 (tkr): abort currently disabled caused by issue i106766 + // initialize(); + // m_xSession->abort(); + OSL_TRACE( "Not implemented. -> #i106766#" ); } + //========================================================================= namespace { @@ -674,7 +676,8 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST( xSeekableStream, DAVRequestEnvironment( getRequestURI(), - new DAVAuthListener_Impl( xEnv, m_aURL ), + new DAVAuthListener_Impl( + xEnv, m_aURL ), aHeaders, xEnv ) ); } catch ( DAVException & e ) @@ -697,7 +700,6 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST( } //========================================================================= - void DAVResourceAccess::POST( const rtl::OUString & rContentType, const rtl::OUString & rReferer, @@ -765,6 +767,7 @@ void DAVResourceAccess::MKCOL( throw( DAVException ) { initialize(); + int errorCount = 0; bool bRetry; do @@ -804,6 +807,7 @@ void DAVResourceAccess::COPY( throw( DAVException ) { initialize(); + int errorCount = 0; bool bRetry; do @@ -845,6 +849,7 @@ void DAVResourceAccess::MOVE( throw( DAVException ) { initialize(); + int errorCount = 0; bool bRetry; do @@ -916,23 +921,124 @@ void DAVResourceAccess::DESTROY( } //========================================================================= -void DAVResourceAccess::LOCK ( - const ucb::Lock & /*rLock*/, - const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ ) - throw( DAVException ) +// set new lock. +void DAVResourceAccess::LOCK( + ucb::Lock & inLock, + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ) { -// initialize(); - OSL_ENSURE( sal_False, "DAVResourceAccess::LOCK - NYI" ); + initialize(); + + int errorCount = 0; + bool bRetry; + do + { + bRetry = false; + try + { + DAVRequestHeaders aHeaders; + getUserRequestHeaders( xEnv, + getRequestURI(), + rtl::OUString::createFromAscii( "LOCK" ), + aHeaders ); + + m_xSession->LOCK( getRequestURI(), + inLock, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( xEnv, m_aURL ), + aHeaders, xEnv ) ); + } + catch ( DAVException & e ) + { + errorCount++; + bRetry = handleException( e, errorCount ); + if ( !bRetry ) + throw; + } + } + while ( bRetry ); } //========================================================================= -void DAVResourceAccess::UNLOCK ( - const ucb::Lock & /*rLock*/, - const uno::Reference< ucb::XCommandEnvironment > & /*xEnv*/ ) - throw( DAVException ) +// refresh existing lock. +sal_Int64 DAVResourceAccess::LOCK( + sal_Int64 nTimeout, + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ) { -// initialize(); - OSL_ENSURE( sal_False, "DAVResourceAccess::UNLOCK - NYI" ); + initialize(); + + sal_Int64 nNewTimeout = 0; + int errorCount = 0; + bool bRetry; + do + { + bRetry = false; + try + { + DAVRequestHeaders aHeaders; + getUserRequestHeaders( xEnv, + getRequestURI(), + rtl::OUString::createFromAscii( "LOCK" ), + aHeaders ); + + nNewTimeout = m_xSession->LOCK( getRequestURI(), + nTimeout, + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( + xEnv, m_aURL ), + aHeaders, xEnv ) ); + } + catch ( DAVException & e ) + { + errorCount++; + bRetry = handleException( e, errorCount ); + if ( !bRetry ) + throw; + } + } + while ( bRetry ); + + return nNewTimeout; +} + +//========================================================================= +void DAVResourceAccess::UNLOCK( + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ) +{ + initialize(); + + int errorCount = 0; + bool bRetry; + do + { + bRetry = false; + try + { + DAVRequestHeaders aHeaders; + getUserRequestHeaders( xEnv, + getRequestURI(), + rtl::OUString::createFromAscii( "UNLOCK" ), + aHeaders ); + + m_xSession->UNLOCK( getRequestURI(), + DAVRequestEnvironment( + getRequestURI(), + new DAVAuthListener_Impl( xEnv, m_aURL ), + aHeaders, xEnv ) ); + } + catch ( DAVException & e ) + { + errorCount++; + bRetry = handleException( e, errorCount ); + if ( !bRetry ) + throw; + } + } + while ( bRetry ); } //========================================================================= @@ -1029,9 +1135,8 @@ void DAVResourceAccess::getUserRequestHeaders( "Value is not a string! Ignoring..." ); } - rRequestHeaders.push_back( DAVRequestHeader( - aRequestHeaders[ n ].Name, - aValue ) ); + rRequestHeaders.push_back( + DAVRequestHeader( aRequestHeaders[ n ].Name, aValue ) ); } } } @@ -1075,7 +1180,6 @@ void DAVResourceAccess::resetUri() } } - //========================================================================= sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount ) throw ( DAVException ) @@ -1095,7 +1199,9 @@ sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount ) // if we have a bad connection try again. Up to three times. case DAVException::DAV_HTTP_ERROR: // retry up to three times, if not a client-side error. - if ( ( e.getStatus() < 400 || e.getStatus() > 499 ) && errorCount < 3) + if ( e.getStatus() > 0 && + ( e.getStatus() < 400 || e.getStatus() > 499 ) && + errorCount < 3 ) { return sal_True; } diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/ucb/source/ucp/webdav/DAVResourceAccess.hxx index 2ab863dc0b24..87e306d94e02 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.hxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVResourceAccess.hxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -59,22 +56,22 @@ class DAVResourceAccess rtl::Reference< DAVSession > m_xSession; rtl::Reference< DAVSessionFactory > m_xSessionFactory; com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > m_xSMgr; + com::sun::star::lang::XMultiServiceFactory > m_xSMgr; std::vector< NeonUri > m_aRedirectURIs; public: DAVResourceAccess() : m_xSessionFactory( 0 ) {} DAVResourceAccess( const com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > & rSMgr, + com::sun::star::lang::XMultiServiceFactory > & rSMgr, rtl::Reference< - DAVSessionFactory > const & rSessionFactory, + DAVSessionFactory > const & rSessionFactory, const rtl::OUString & rURL ); DAVResourceAccess( const DAVResourceAccess & rOther ); DAVResourceAccess & operator=( const DAVResourceAccess & rOther ); void setURL( const rtl::OUString & rNewURL ) - throw( DAVException ); + throw ( DAVException ); void resetUri(); @@ -86,146 +83,156 @@ public: // DAV methods // +#if 0 // currently not used, but please don't remove code void OPTIONS( DAVCapabilities & rCapabilities, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); +#endif // allprop & named void PROPFIND( const Depth nDepth, - const std::vector< rtl::OUString > & rPropertyNames, - std::vector< DAVResource > & rResources, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + const std::vector< rtl::OUString > & rPropertyNames, + std::vector< DAVResource > & rResources, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); // propnames void PROPFIND( const Depth nDepth, - std::vector< DAVResourceInfo > & rResInfo, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + std::vector< DAVResourceInfo > & rResInfo, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void PROPPATCH( const std::vector< ProppatchValue > & rValues, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& xEnv ) - throw( DAVException ); + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& xEnv ) + throw ( DAVException ); void HEAD( const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' DAVResource & rResource, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment >& xEnv ) + throw ( DAVException ); com::sun::star::uno::Reference< com::sun::star::io::XInputStream > GET( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void GET( com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & rStream, + com::sun::star::io::XOutputStream > & rStream, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); com::sun::star::uno::Reference< com::sun::star::io::XInputStream > GET( const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' DAVResource & rResource, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void GET( com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & rStream, + com::sun::star::io::XOutputStream > & rStream, const std::vector< rtl::OUString > & rHeaderNames, // empty == 'all' DAVResource & rResource, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void PUT( const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & rStream, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::io::XInputStream > & rStream, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); com::sun::star::uno::Reference< com::sun::star::io::XInputStream > POST( const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & rInputStream, - const com::sun::star::uno::Reference< + const rtl::OUString & rReferer, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & rInputStream, + const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( DAVException ); void POST( const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & rInputStream, - com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & rOutputStream, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& xEnv ) + const rtl::OUString & rReferer, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & rInputStream, + com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > & rOutputStream, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( DAVException ); void MKCOL( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void COPY( const ::rtl::OUString & rSourcePath, - const ::rtl::OUString & rDestinationURI, - sal_Bool bOverwrite, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + const ::rtl::OUString & rDestinationURI, + sal_Bool bOverwrite, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void MOVE( const ::rtl::OUString & rSourcePath, - const ::rtl::OUString & rDestinationURI, - sal_Bool bOverwrite, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + const ::rtl::OUString & rDestinationURI, + sal_Bool bOverwrite, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void DESTROY( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); + // set new lock. void - LOCK( const com::sun::star::ucb::Lock & rLock, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + LOCK( com::sun::star::ucb::Lock & inLock, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw( DAVException ); + + // refresh existing lock. + sal_Int64 + LOCK( sal_Int64 nTimeout, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void - UNLOCK( const com::sun::star::ucb::Lock & rLock, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) - throw( DAVException ); + UNLOCK( const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv ) + throw ( DAVException ); void - ABORT() - throw( DAVException ); + abort() + throw ( DAVException ); // helper - static void getUserRequestHeaders( - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv, - const rtl::OUString & rURI, - const rtl::OUString & rMethod, - DAVRequestHeaders & rRequestHeaders ); + static void + getUserRequestHeaders( + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment > & xEnv, + const rtl::OUString & rURI, + const rtl::OUString & rMethod, + DAVRequestHeaders & rRequestHeaders ); private: const rtl::OUString & getRequestURI() const; diff --git a/ucb/source/ucp/webdav/DAVSession.hxx b/ucb/source/ucp/webdav/DAVSession.hxx index b6de1c5b10ad..4ea24f372c12 100644 --- a/ucb/source/ucp/webdav/DAVSession.hxx +++ b/ucb/source/ucp/webdav/DAVSession.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVSession.hxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,7 +39,9 @@ #include "DAVTypes.hxx" #include "DAVRequestEnvironment.hxx" - +namespace com { namespace sun { namespace star { namespace ucb { + struct Lock; +} } } } namespace webdav_ucp { @@ -73,28 +72,28 @@ public: // DAV methods // - virtual void OPTIONS( const ::rtl::OUString & inPath, + virtual void OPTIONS( const ::rtl::OUString & inPath, DAVCapabilities & outCapabilities, const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; // allprop & named - virtual void PROPFIND( const ::rtl::OUString & inPath, - const Depth inDepth, + virtual void PROPFIND( const ::rtl::OUString & inPath, + const Depth inDepth, const std::vector< ::rtl::OUString > & inPropertyNames, - std::vector< DAVResource > & ioResources, + std::vector< DAVResource > & ioResources, const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; // propnames - virtual void PROPFIND( const ::rtl::OUString & inPath, - const Depth inDepth, + virtual void PROPFIND( const ::rtl::OUString & inPath, + const Depth inDepth, std::vector< DAVResourceInfo > & ioResInfo, const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - virtual void PROPPATCH( const ::rtl::OUString & inPath, - const std::vector< ProppatchValue > & inValues, + virtual void PROPPATCH( const ::rtl::OUString & inPath, + const std::vector< ProppatchValue > & inValues, const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; @@ -105,87 +104,95 @@ public: throw( DAVException ) = 0; virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - GET( const ::rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) + GET( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - virtual void GET( const ::rtl::OUString & inPath, - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o, - const DAVRequestEnvironment & rEnv ) + virtual void GET( const ::rtl::OUString & inPath, + com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream >& o, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - GET( const ::rtl::OUString & inPath, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) + GET( const ::rtl::OUString & inPath, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - virtual void GET( const ::rtl::OUString & inPath, - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) + virtual void + GET( const ::rtl::OUString & inPath, + com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& o, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - virtual void PUT( const ::rtl::OUString & inPath, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream >& s, - const DAVRequestEnvironment & rEnv ) - throw( DAVException ) = 0; - - virtual void ABORT() + virtual void PUT( const ::rtl::OUString & inPath, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream >& s, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > - POST( const rtl::OUString & inPath, - const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & inInputStream, - const DAVRequestEnvironment & rEnv ) + POST( const rtl::OUString & inPath, + const rtl::OUString & rContentType, + const rtl::OUString & rReferer, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & inInputStream, + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) = 0; virtual void POST( const rtl::OUString & inPath, const rtl::OUString & rContentType, const rtl::OUString & rReferer, const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & inInputStream, + com::sun::star::io::XInputStream > & inInputStream, com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & oOutputStream, + com::sun::star::io::XOutputStream > & oOutputStream, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) = 0; - virtual void MKCOL( const ::rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) + virtual void MKCOL( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - virtual void COPY( const ::rtl::OUString & inSource, - const ::rtl::OUString & inDestination, - const DAVRequestEnvironment & rEnv, - sal_Bool inOverwrite = false ) + virtual void COPY( const ::rtl::OUString & inSource, + const ::rtl::OUString & inDestination, + const DAVRequestEnvironment & rEnv, + sal_Bool inOverwrite = false ) throw( DAVException ) = 0; - virtual void MOVE( const ::rtl::OUString & inSource, - const ::rtl::OUString & inDestination, - const DAVRequestEnvironment & rEnv, - sal_Bool inOverwrite = false ) + virtual void MOVE( const ::rtl::OUString & inSource, + const ::rtl::OUString & inDestination, + const DAVRequestEnvironment & rEnv, + sal_Bool inOverwrite = false ) throw( DAVException ) = 0; - virtual void DESTROY( const ::rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) + virtual void DESTROY( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) throw( DAVException ) = 0; - // Note: Uncomment the following if locking support is required - /* - virtual void LOCK ( const Lock & inLock, - const DAVRequestEnvironment & rEnv ) - throw( DAVException ) = 0; + // set new lock. + virtual void LOCK( const ::rtl::OUString & inPath, + com::sun::star::ucb::Lock & inLock, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ) = 0; - virtual void UNLOCK ( const Lock & inLock, - const DAVRequestEnvironment & rEnv ) + // refresh existing lock. + virtual sal_Int64 LOCK( const ::rtl::OUString & inPath, + sal_Int64 nTimeout, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ) = 0; + + virtual void UNLOCK( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ) = 0; + + virtual void abort() throw( DAVException ) = 0; - */ + protected: rtl::Reference< DAVSessionFactory > m_xFactory; @@ -210,4 +217,3 @@ private: } // namespace webdav_ucp #endif // _DAVSESSION_HXX_ - diff --git a/ucb/source/ucp/webdav/DAVSessionFactory.cxx b/ucb/source/ucp/webdav/DAVSessionFactory.cxx index 209aa00ba7f6..86d513f23fd6 100644 --- a/ucb/source/ucp/webdav/DAVSessionFactory.cxx +++ b/ucb/source/ucp/webdav/DAVSessionFactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVSessionFactory.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVSessionFactory.hxx b/ucb/source/ucp/webdav/DAVSessionFactory.hxx index 8584222872de..eb1f22ace925 100644 --- a/ucb/source/ucp/webdav/DAVSessionFactory.hxx +++ b/ucb/source/ucp/webdav/DAVSessionFactory.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVSessionFactory.hxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DAVTypes.hxx b/ucb/source/ucp/webdav/DAVTypes.hxx index 7a5b564f2ebd..04da2fefed0c 100644 --- a/ucb/source/ucp/webdav/DAVTypes.hxx +++ b/ucb/source/ucp/webdav/DAVTypes.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DAVTypes.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DateTimeHelper.cxx b/ucb/source/ucp/webdav/DateTimeHelper.cxx index ef89b870b10a..41caac39f64b 100644 --- a/ucb/source/ucp/webdav/DateTimeHelper.cxx +++ b/ucb/source/ucp/webdav/DateTimeHelper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DateTimeHelper.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/DateTimeHelper.hxx b/ucb/source/ucp/webdav/DateTimeHelper.hxx index e49ddb902b5f..c857457d0534 100644 --- a/ucb/source/ucp/webdav/DateTimeHelper.hxx +++ b/ucb/source/ucp/webdav/DateTimeHelper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DateTimeHelper.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/LinkSequence.cxx b/ucb/source/ucp/webdav/LinkSequence.cxx index c9865cb5b8c2..39d8d9cecc38 100644 --- a/ucb/source/ucp/webdav/LinkSequence.cxx +++ b/ucb/source/ucp/webdav/LinkSequence.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LinkSequence.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -64,12 +61,11 @@ struct LinkSequenceParseContext extern "C" int LinkSequence_startelement_callback( void *, int parent, - const char *nspace, + const char * /*nspace*/, const char *name, const char ** ) { - if ( ( name != 0 ) && - ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) ) + if ( name != 0 ) { switch ( parent ) { @@ -192,7 +188,7 @@ bool LinkSequence::createFromXML( const rtl::OString & rInData, rOutData[ nCount - 1 ] = *aCtx.pLink; } - nStart = nEnd + TOKEN_LENGTH + 1; + nStart = nEnd + TOKEN_LENGTH; nEnd = rInData.indexOf( "</link>", nStart ); } @@ -215,11 +211,11 @@ bool LinkSequence::toXML( const uno::Sequence< ucb::Link > & rInData, for ( sal_Int32 n = 0; n < nCount; ++n ) { - rOutData += aPre; - rOutData += rInData[ n ].Source; - rOutData += aMid; - rOutData += rInData[ n ].Destination; - rOutData += aEnd; + rOutData += aPre; + rOutData += rInData[ n ].Source; + rOutData += aMid; + rOutData += rInData[ n ].Destination; + rOutData += aEnd; } return true; } diff --git a/ucb/source/ucp/webdav/LinkSequence.hxx b/ucb/source/ucp/webdav/LinkSequence.hxx index 2340f21fa8a7..49bf883f1099 100644 --- a/ucb/source/ucp/webdav/LinkSequence.hxx +++ b/ucb/source/ucp/webdav/LinkSequence.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LinkSequence.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/LockEntrySequence.cxx b/ucb/source/ucp/webdav/LockEntrySequence.cxx index 353ff6f875d7..762170e7e057 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.cxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LockEntrySequence.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -64,12 +61,11 @@ struct LockEntrySequenceParseContext extern "C" int LockEntrySequence_startelement_callback( void *, int parent, - const char *nspace, + const char * /*nspace*/, const char *name, const char ** ) { - if ( ( name != 0 ) && - ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) ) + if ( name != 0 ) { switch ( parent ) { @@ -83,6 +79,31 @@ extern "C" int LockEntrySequence_startelement_callback( return STATE_LOCKSCOPE; else if ( strcmp( name, "locktype" ) == 0 ) return STATE_LOCKTYPE; + +#define IIS_BUGS_WORKAROUND + +#ifdef IIS_BUGS_WORKAROUND + /* IIS (6) returns XML violating RFC 4918 + for DAV:supportedlock property value. + + <lockentry> + <write></write> + <shared></shared> + </lockentry> + <lockentry> + <write></write> + <exclusive></exclusive> + </lockentry> + + Bother... + */ + else if ( strcmp( name, "exclusive" ) == 0 ) + return STATE_EXCLUSIVE; + else if ( strcmp( name, "shared" ) == 0 ) + return STATE_SHARED; + else if ( strcmp( name, "write" ) == 0 ) + return STATE_WRITE; +#endif break; case STATE_LOCKSCOPE: @@ -165,7 +186,7 @@ extern "C" int LockEntrySequence_endelement_callback( // static bool LockEntrySequence::createFromXML( const rtl::OString & rInData, uno::Sequence< - ucb::LockEntry > & rOutData ) + ucb::LockEntry > & rOutData ) { const sal_Int32 TOKEN_LENGTH = 12; // </lockentry> bool success = true; @@ -191,8 +212,8 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData, &aCtx ); ne_xml_parse( parser, - rInData.getStr() + nStart, - nEnd - nStart + TOKEN_LENGTH ); + rInData.getStr() + nStart, + nEnd - nStart + TOKEN_LENGTH ); #if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); @@ -214,7 +235,7 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData, rOutData[ nCount - 1 ] = *aCtx.pEntry; } - nStart = nEnd + TOKEN_LENGTH + 1; + nStart = nEnd + TOKEN_LENGTH; nEnd = rInData.indexOf( "</lockentry>", nStart ); } diff --git a/ucb/source/ucp/webdav/LockEntrySequence.hxx b/ucb/source/ucp/webdav/LockEntrySequence.hxx index bef13206b27b..12c407100ecf 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.hxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LockEntrySequence.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index f34ede38d40e..cd5f12708d58 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LockSequence.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -74,12 +71,11 @@ struct LockSequenceParseContext extern "C" int LockSequence_startelement_callback( void *, int parent, - const char *nspace, + const char * /*nspace*/, const char *name, const char ** ) { - if ( ( name != 0 ) && - ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) ) + if ( name != 0 ) { switch ( parent ) { @@ -347,7 +343,7 @@ bool LockSequence::createFromXML( const rtl::OString & rInData, rOutData[ nCount - 1 ] = *aCtx.pLock; } - nStart = nEnd + TOKEN_LENGTH + 1; + nStart = nEnd + TOKEN_LENGTH; nEnd = rInData.indexOf( "</activelock>", nStart ); } diff --git a/ucb/source/ucp/webdav/LockSequence.hxx b/ucb/source/ucp/webdav/LockSequence.hxx index 90ffbd332ac0..85d4cdee77f5 100644 --- a/ucb/source/ucp/webdav/LockSequence.hxx +++ b/ucb/source/ucp/webdav/LockSequence.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: LockSequence.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonHeadRequest.cxx b/ucb/source/ucp/webdav/NeonHeadRequest.cxx index e81c8e33b24a..2880a86a727d 100644 --- a/ucb/source/ucp/webdav/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav/NeonHeadRequest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonHeadRequest.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonHeadRequest.hxx b/ucb/source/ucp/webdav/NeonHeadRequest.hxx index f7ce59a44ed0..eb79ae7658c2 100644 --- a/ucb/source/ucp/webdav/NeonHeadRequest.hxx +++ b/ucb/source/ucp/webdav/NeonHeadRequest.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonHeadRequest.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonInputStream.cxx b/ucb/source/ucp/webdav/NeonInputStream.cxx index d592e1ecef8e..2e142af955c8 100644 --- a/ucb/source/ucp/webdav/NeonInputStream.cxx +++ b/ucb/source/ucp/webdav/NeonInputStream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonInputStream.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonInputStream.hxx b/ucb/source/ucp/webdav/NeonInputStream.hxx index 4f224cc793c4..55bf64b1bfcc 100644 --- a/ucb/source/ucp/webdav/NeonInputStream.hxx +++ b/ucb/source/ucp/webdav/NeonInputStream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonInputStream.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonLockStore.cxx b/ucb/source/ucp/webdav/NeonLockStore.cxx new file mode 100644 index 000000000000..82510fcc9b71 --- /dev/null +++ b/ucb/source/ucp/webdav/NeonLockStore.cxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_ucb.hxx" + +#include <ne_locks.h> +#include <ne_uri.h> +#include "rtl/ustring.hxx" +#include "osl/time.h" +#include "osl/thread.hxx" +#include "NeonSession.hxx" +#include "NeonLockStore.hxx" + +using namespace webdav_ucp; + +namespace webdav_ucp { + +class TickerThread : public osl::Thread +{ + bool m_bFinish; + NeonLockStore & m_rLockStore; + +public: + + TickerThread( NeonLockStore & rLockStore ) + : osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {} + + void finish() { m_bFinish = true; } + +protected: + + virtual void SAL_CALL run(); +}; + +} // namespace webdav_ucp + +// ------------------------------------------------------------------- +void TickerThread::run() +{ + OSL_TRACE( "TickerThread: start." ); + + // we have to go through the loop more often to be able to finish ~quickly + const int nNth = 25; + + int nCount = nNth; + while ( !m_bFinish ) + { + if ( nCount-- <= 0 ) + { + m_rLockStore.refreshLocks(); + nCount = nNth; + } + + TimeValue aTV; + aTV.Seconds = 0; + aTV.Nanosec = 1000000000 / nNth; + wait( aTV ); + } + + OSL_TRACE( "TickerThread: stop." ); +} + +// ------------------------------------------------------------------- +NeonLockStore::NeonLockStore() + : m_pNeonLockStore( ne_lockstore_create() ), + m_pTickerThread( 0 ) +{ + OSL_ENSURE( m_pNeonLockStore, "Unable to create neon lock store!" ); +} + +// ------------------------------------------------------------------- +NeonLockStore::~NeonLockStore() +{ + stopTicker(); + + // release active locks, if any. + OSL_ENSURE( m_aLockInfoMap.size() == 0, + "NeonLockStore::~NeonLockStore - Releasing active locks!" ); + + LockInfoMap::const_iterator it( m_aLockInfoMap.begin() ); + const LockInfoMap::const_iterator end( m_aLockInfoMap.end() ); + while ( it != end ) + { + NeonLock * pLock = (*it).first; + (*it).second.xSession->UNLOCK( pLock ); + + ne_lockstore_remove( m_pNeonLockStore, pLock ); + ne_lock_destroy( pLock ); + + ++it; + } + + ne_lockstore_destroy( m_pNeonLockStore ); +} + +// ------------------------------------------------------------------- +void NeonLockStore::startTicker() +{ + osl::MutexGuard aGuard( m_aMutex ); + + if ( !m_pTickerThread ) + { + m_pTickerThread = new TickerThread( *this ); + m_pTickerThread->create(); + } +} + +// ------------------------------------------------------------------- +void NeonLockStore::stopTicker() +{ + osl::MutexGuard aGuard( m_aMutex ); + + if ( m_pTickerThread ) + { + m_pTickerThread->finish(); + m_pTickerThread->join(); + delete m_pTickerThread; + m_pTickerThread = 0; + } +} + +// ------------------------------------------------------------------- +void NeonLockStore::registerSession( HttpSession * pHttpSession ) +{ + osl::MutexGuard aGuard( m_aMutex ); + + ne_lockstore_register( m_pNeonLockStore, pHttpSession ); +} + +// ------------------------------------------------------------------- +NeonLock * NeonLockStore::findByUri( rtl::OUString const & rUri ) +{ + osl::MutexGuard aGuard( m_aMutex ); + + ne_uri aUri; + ne_uri_parse( rtl::OUStringToOString( + rUri, RTL_TEXTENCODING_UTF8 ).getStr(), &aUri ); + return ne_lockstore_findbyuri( m_pNeonLockStore, &aUri ); +} + +// ------------------------------------------------------------------- +void NeonLockStore::addLock( NeonLock * pLock, + rtl::Reference< NeonSession > const & xSession, + sal_Int32 nLastChanceToSendRefreshRequest ) +{ + osl::MutexGuard aGuard( m_aMutex ); + + ne_lockstore_add( m_pNeonLockStore, pLock ); + m_aLockInfoMap[ pLock ] + = LockInfo( xSession, nLastChanceToSendRefreshRequest ); + + startTicker(); +} + +// ------------------------------------------------------------------- +void NeonLockStore::updateLock( NeonLock * pLock, + sal_Int32 nLastChanceToSendRefreshRequest ) +{ + osl::MutexGuard aGuard( m_aMutex ); + + LockInfoMap::iterator it( m_aLockInfoMap.find( pLock ) ); + OSL_ENSURE( it != m_aLockInfoMap.end(), + "NeonLockStore::updateLock: lock not found!" ); + + if ( it != m_aLockInfoMap.end() ) + { + (*it).second.nLastChanceToSendRefreshRequest + = nLastChanceToSendRefreshRequest; + } +} + +// ------------------------------------------------------------------- +void NeonLockStore::removeLock( NeonLock * pLock ) +{ + osl::MutexGuard aGuard( m_aMutex ); + + m_aLockInfoMap.erase( pLock ); + ne_lockstore_remove( m_pNeonLockStore, pLock ); + + if ( m_aLockInfoMap.size() == 0 ) + stopTicker(); +} + +// ------------------------------------------------------------------- +void NeonLockStore::refreshLocks() +{ + osl::MutexGuard aGuard( m_aMutex ); + + LockInfoMap::iterator it( m_aLockInfoMap.begin() ); + const LockInfoMap::const_iterator end( m_aLockInfoMap.end() ); + while ( it != end ) + { + LockInfo & rInfo = (*it).second; + if ( rInfo.nLastChanceToSendRefreshRequest != -1 ) + { + // 30 seconds or less remaining until lock expires? + TimeValue t1; + osl_getSystemTime( &t1 ); + if ( rInfo.nLastChanceToSendRefreshRequest - 30 + <= sal_Int32( t1.Seconds ) ) + { + // refresh the lock. + sal_Int32 nlastChanceToSendRefreshRequest = -1; + if ( rInfo.xSession->LOCK( + (*it).first, + /* out param */ nlastChanceToSendRefreshRequest ) ) + { + rInfo.nLastChanceToSendRefreshRequest + = nlastChanceToSendRefreshRequest; + } + else + { + // refresh failed. stop auto-refresh. + rInfo.nLastChanceToSendRefreshRequest = -1; + } + } + } + ++it; + } +} diff --git a/ucb/source/ucp/webdav/NeonLockStore.hxx b/ucb/source/ucp/webdav/NeonLockStore.hxx new file mode 100644 index 000000000000..66f771f61901 --- /dev/null +++ b/ucb/source/ucp/webdav/NeonLockStore.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_NEONLOCKSTORE_HXX +#define INCLUDED_NEONLOCKSTORE_HXX + +#include <map> +#include "ne_locks.h" +#include "osl/mutex.hxx" +#include "rtl/ref.hxx" +#include "NeonTypes.hxx" + +namespace webdav_ucp +{ + +class TickerThread; +class NeonSession; + +struct ltptr +{ + bool operator()( const NeonLock * p1, const NeonLock * p2 ) const + { + return p1 < p2; + } +}; + +typedef struct _LockInfo +{ + rtl::Reference< NeonSession > xSession; + sal_Int32 nLastChanceToSendRefreshRequest; + + _LockInfo() + : nLastChanceToSendRefreshRequest( -1 ) {} + + _LockInfo( rtl::Reference< NeonSession > const & _xSession, + sal_Int32 _nLastChanceToSendRefreshRequest ) + : xSession( _xSession ), + nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {} + +} LockInfo; + +typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap; + +class NeonLockStore +{ + osl::Mutex m_aMutex; + ne_lock_store * m_pNeonLockStore; + TickerThread * m_pTickerThread; + LockInfoMap m_aLockInfoMap; + +public: + NeonLockStore(); + ~NeonLockStore(); + + void registerSession( HttpSession * pHttpSession ); + + NeonLock * findByUri( rtl::OUString const & rUri ); + + void addLock( NeonLock * pLock, + rtl::Reference< NeonSession > const & xSession, + // time in seconds since Jan 1 1970 + // -1: infinite lock, no refresh + sal_Int32 nLastChanceToSendRefreshRequest ); + + void updateLock( NeonLock * pLock, + sal_Int32 nLastChanceToSendRefreshRequest ); + + void removeLock( NeonLock * pLock ); + + void refreshLocks(); + +private: + void startTicker(); + void stopTicker(); +}; + +} // namespace webdav_ucp + +#endif // INCLUDED_NEONLOCKSTORE_HXX diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx index 6171d3fa0bfc..85b5ea0393e0 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonPropFindRequest.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -30,14 +27,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucb.hxx" -#include <osl/diagnose.h> + +#include "osl/diagnose.h" +#include "rtl/strbuf.hxx" #include "NeonTypes.hxx" #include "DAVException.hxx" #include "DAVProperties.hxx" #include "NeonPropFindRequest.hxx" -#ifndef _LINKSEQUENCE_HXX_ #include "LinkSequence.hxx" -#endif #include "LockSequence.hxx" #include "LockEntrySequence.hxx" #include "UCBDeadPropertyValue.hxx" @@ -49,6 +46,40 @@ using namespace std; using namespace webdav_ucp; // ------------------------------------------------------------------- +namespace +{ + // strip "DAV:" namespace from XML snippets to avoid + // parser error (undeclared namespace) later on. + rtl::OString stripDavNamespace( const rtl::OString & in ) + { + const rtl::OString inXML( in.toAsciiLowerCase() ); + + rtl::OStringBuffer buf; + sal_Int32 start = 0; + sal_Int32 end = inXML.indexOf( "dav:" ); + while ( end != -1 ) + { + if ( inXML[ end - 1 ] == '<' || + inXML[ end - 1 ] == '/' ) + { + // copy from original buffer - preserve case. + buf.append( in.copy( start, end - start ) ); + } + else + { + // copy from original buffer - preserve case. + buf.append( in.copy( start, end - start + 4 ) ); + } + start = end + 4; + end = inXML.indexOf( "dav:", start ); + } + buf.append( inXML.copy( start ) ); + + return rtl::OString( buf.makeStringAndClear() ); + } +} + +// ------------------------------------------------------------------- extern "C" int NPFR_propfind_iter( void* userdata, const NeonPropName* pname, const char* value, @@ -57,9 +88,9 @@ extern "C" int NPFR_propfind_iter( void* userdata, /* HTTP Response Status Classes: - - 1: Informational - Request received, continuing process + - 1: Informational - Request received, continuing process - - 2: Success - The action was successfully received, + - 2: Success - The action was successfully received, understood, and accepted - 3: Redirection - Further action must be taken in order to @@ -79,18 +110,22 @@ extern "C" int NPFR_propfind_iter( void* userdata, DAVPropertyValue thePropertyValue; thePropertyValue.IsCaseSensitive = true; + OSL_ENSURE( pname->nspace, "NPFR_propfind_iter - No namespace!" ); + DAVProperties::createUCBPropName( pname->nspace, - pname->name, - thePropertyValue.Name ); + pname->name, + thePropertyValue.Name ); bool bHasValue = false; if ( DAVProperties::isUCBDeadProperty( *pname ) ) { // DAV dead property added by WebDAV UCP? if ( UCBDeadPropertyValue::createFromXML( - value, thePropertyValue.Value ) ) + value, thePropertyValue.Value ) ) + { OSL_ENSURE( thePropertyValue.Value.hasValue(), - "NeonPropFindRequest::propfind_iter - No value!" ); + "NPFR_propfind_iter - No value!" ); bHasValue = true; + } } if ( !bHasValue ) @@ -102,13 +137,9 @@ extern "C" int NPFR_propfind_iter( void* userdata, aValue = aValue.trim(); // #107358# remove leading/trailing spaces if ( aValue.getLength() ) { - aValue = aValue.toAsciiLowerCase(); - if ( - ( aValue.compareTo( - RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 ) || - ( aValue.compareTo( - RTL_CONSTASCII_STRINGPARAM( "<dav:collection" ) ) == 0 ) - ) + aValue = stripDavNamespace( aValue ).toAsciiLowerCase(); + if ( aValue.compareTo( + RTL_CONSTASCII_STRINGPARAM( "<collection" ) ) == 0 ) { thePropertyValue.Value <<= OUString::createFromAscii( "collection" ); @@ -125,20 +156,23 @@ extern "C" int NPFR_propfind_iter( void* userdata, pname->name, "supportedlock" ) == 0 ) { Sequence< LockEntry > aEntries; - LockEntrySequence::createFromXML( value, aEntries ); + LockEntrySequence::createFromXML( + stripDavNamespace( value ), aEntries ); thePropertyValue.Value <<= aEntries; } else if ( rtl_str_compareIgnoreAsciiCase( pname->name, "lockdiscovery" ) == 0 ) { Sequence< Lock > aLocks; - LockSequence::createFromXML( value, aLocks ); + LockSequence::createFromXML( + stripDavNamespace( value ), aLocks ); thePropertyValue.Value <<= aLocks; } else if ( rtl_str_compareIgnoreAsciiCase( pname->name, "source" ) == 0 ) { Sequence< Link > aLinks; - LinkSequence::createFromXML( value, aLinks ); + LinkSequence::createFromXML( + stripDavNamespace( value ), aLinks ); thePropertyValue.Value <<= aLinks; } else @@ -168,10 +202,10 @@ extern "C" void NPFR_propfind_results( void* userdata, #if NEON_VERSION >= 0x0260 DAVResource theResource( - OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); + OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); #else DAVResource theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); + OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); #endif ne_propset_iterate( set, NPFR_propfind_iter, &theResource ); @@ -210,10 +244,10 @@ extern "C" void NPFR_propnames_results( void* userdata, // Create entry for the resource. #if NEON_VERSION >= 0x0260 DAVResourceInfo theResource( - OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); + OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); #else DAVResourceInfo theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); + OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); #endif // Fill entry. @@ -247,7 +281,7 @@ NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession, { // Split fullname into namespace and name! DAVProperties::createNeonPropName( - inPropNames[ theIndex ], thePropNames[ theIndex ] ); + inPropNames[ theIndex ], thePropNames[ theIndex ] ); } thePropNames[ theIndex ].nspace = NULL; thePropNames[ theIndex ].name = NULL; @@ -288,7 +322,7 @@ NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession, NeonPropFindRequest::NeonPropFindRequest( HttpSession* inSession, const char* inPath, - const Depth inDepth, + const Depth inDepth, std::vector< DAVResourceInfo > & ioResInfo, int & nError ) { diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.hxx b/ucb/source/ucp/webdav/NeonPropFindRequest.hxx index dab206d3b99d..26e8793e2b96 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.hxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonPropFindRequest.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 25126f619540..0d979ae72ada 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonSession.cxx,v $ - * $Revision: 1.55.12.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -34,12 +31,14 @@ #include <hash_map> #include <vector> #include <string.h> +#include "osl/diagnose.h" +#include "osl/time.h" #include <rtl/string.h> #include <ne_socket.h> #include <ne_auth.h> #include <ne_redirect.h> -#include <ne_locks.h> #include <ne_ssl.h> +#include <ne_compress.h> #include "libxml/parser.h" #include "rtl/ustrbuf.hxx" #include "comphelper/sequence.hxx" @@ -62,6 +61,7 @@ #include <com/sun/star/security/CertificateContainer.hpp> #include <com/sun/star/security/XCertificateContainer.hpp> #include <com/sun/star/task/XMasterPasswordHandling.hpp> +#include <com/sun/star/ucb/Lock.hpp> #include <com/sun/star/xml/crypto/XSEInitializer.hpp> using namespace com::sun::star; @@ -119,10 +119,6 @@ typedef std::hash_map RequestDataMap; // ------------------------------------------------------------------- -// static members! -bool NeonSession::m_bGlobalsInited = false; -osl::Mutex NeonSession::m_aGlobalMutex; -// ------------------------------------------------------------------- // Helper fuction // ------------------------------------------------------------------- static sal_uInt16 makeStatusCode( const rtl::OUString & rStatusText ) @@ -197,14 +193,14 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData, const char * inBuf, size_t inLen ) { - // neon calls this function with (inLen == 0)... + // neon sometimes calls this function with (inLen == 0)... if ( inLen > 0 ) { NeonRequestContext * pCtx = static_cast< NeonRequestContext * >( inUserData ); rtl::Reference< NeonInputStream > xInputStream( - pCtx->xInputStream); + pCtx->xInputStream ); if ( xInputStream.is() ) xInputStream->AddToStream( inBuf, inLen ); @@ -327,10 +323,11 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, bool bCanUseSystemCreds = false; #ifdef NE_FEATURE_SSPI - bCanUseSystemCreds = (attempt == 0) && // avoid endless loops - ne_has_support( NE_FEATURE_SSPI ) && // Windows-only feature. - ( ( ne_strcasecmp( inAuthProtocol, "NTLM" ) == 0 ) || - ( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) ); + bCanUseSystemCreds + = (attempt == 0) && // avoid endless loops + ne_has_support( NE_FEATURE_SSPI ) && // Windows-only feature. + ( ( ne_strcasecmp( inAuthProtocol, "NTLM" ) == 0 ) || + ( ne_strcasecmp( inAuthProtocol, "Negotiate" ) == 0 ) ); #endif // #i97003# (tkr): Ask XMasterPasswordHandling if we should store the @@ -342,7 +339,7 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, uno::Reference< task::XMasterPasswordHandling >( theSession->getMSF()->createInstance( rtl::OUString::createFromAscii( - "com.sun.star.task.PasswordContainer" )), + "com.sun.star.task.PasswordContainer" ) ), uno::UNO_QUERY ); } catch ( uno::Exception const & ) @@ -406,7 +403,7 @@ namespace { } return sPart; } -} +} // namespace // ------------------------------------------------------------------- extern "C" int NeonSession_CertificationNotify( void *userdata, @@ -445,7 +442,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata, pSession->getHostName(), cert_subject ) ); if ( certificateContainer != security::CertificateContainerStatus_NOCERT ) - return + return certificateContainer == security::CertificateContainerStatus_TRUSTED ? 0 : 1; @@ -476,7 +473,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata, rtl::OString sEECertB64( eeCertB64 ); - uno::Reference< com::sun::star::security::XCertificate > xEECert( + uno::Reference< security::XCertificate > xEECert( xSecurityEnv->createCertificateFromAscii( rtl::OStringToOUString( sEECertB64, RTL_TEXTENCODING_ASCII_US ) ) ); @@ -617,36 +614,41 @@ extern "C" void NeonSession_PreSendRequest( ne_request * req, } } - const DAVRequestHeaders & rHeaders - = pSession->getRequestEnvironment().m_aRequestHeaders; + const DAVRequestHeaders & rHeaders + = pSession->getRequestEnvironment().m_aRequestHeaders; - DAVRequestHeaders::const_iterator it1( rHeaders.begin() ); - const DAVRequestHeaders::const_iterator end1( rHeaders.end() ); + DAVRequestHeaders::const_iterator it1( rHeaders.begin() ); + const DAVRequestHeaders::const_iterator end1( rHeaders.end() ); - while ( it1 != end1 ) - { - rtl::OString aHeader - = rtl::OUStringToOString( (*it1).first, - RTL_TEXTENCODING_UTF8 ); - rtl::OString aValue - = rtl::OUStringToOString( (*it1).second, - RTL_TEXTENCODING_UTF8 ); - ne_buffer_concat( headers, aHeader.getStr(), ": ", - aValue.getStr(), EOL, NULL ); - - ++it1; + while ( it1 != end1 ) + { + rtl::OString aHeader + = rtl::OUStringToOString( (*it1).first, + RTL_TEXTENCODING_UTF8 ); + rtl::OString aValue + = rtl::OUStringToOString( (*it1).second, + RTL_TEXTENCODING_UTF8 ); + ne_buffer_concat( headers, aHeader.getStr(), ": ", + aValue.getStr(), EOL, NULL ); + + ++it1; + } } } -} // namespace +// ------------------------------------------------------------------- +// static members! +bool NeonSession::m_bGlobalsInited = false; +osl::Mutex NeonSession::m_aGlobalMutex; +NeonLockStore NeonSession::m_aNeonLockStore; // ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- NeonSession::NeonSession( - const rtl::Reference< DAVSessionFactory > & rSessionFactory, - const rtl::OUString& inUri, - const ucbhelper::InternetProxyDecider & rProxyDecider ) + const rtl::Reference< DAVSessionFactory > & rSessionFactory, + const rtl::OUString& inUri, + const ucbhelper::InternetProxyDecider & rProxyDecider ) throw ( DAVException ) : DAVSession( rSessionFactory ), m_pHttpSession( 0 ), @@ -657,8 +659,6 @@ NeonSession::NeonSession( m_aScheme = theUri.GetScheme(); m_aHostName = theUri.GetHost(); m_nPort = theUri.GetPort(); - -// Init(); } // ------------------------------------------------------------------- @@ -670,17 +670,17 @@ NeonSession::~NeonSession( ) { ne_session_destroy( m_pHttpSession ); m_pHttpSession = 0; - // Note: Uncomment the following if locking support is required - /* - if ( mNeonLockSession != NULL ) - { - ne_lock_unregister( mNeonLockSession ); - mNeonLockSession = NULL; - } - */ } + delete static_cast< RequestDataMap * >( m_pRequestData ); +} - delete static_cast<RequestDataMap*>(m_pRequestData); +// ------------------------------------------------------------------- +void NeonSession::Init( const DAVRequestEnvironment & rEnv ) + throw ( DAVException ) +{ + osl::Guard< osl::Mutex > theGuard( m_aMutex ); + m_aEnv = rEnv; + Init(); } // ------------------------------------------------------------------- @@ -693,7 +693,7 @@ void NeonSession::Init() if ( m_pHttpSession == 0 ) { - // Ensure that Neon sockets are initialize + // Ensure that Neon sockets are initialized // --> tkr #151111# crashed if copy and pasted pictures from the internet // ne_sock_init() was executed by two threads at the same time. @@ -705,9 +705,23 @@ void NeonSession::Init() throw DAVException( DAVException::DAV_SESSION_CREATE, NeonUri::makeConnectionEndPointString( m_aHostName, m_nPort ) ); + // #122205# - libxml2 needs to be initialized once if used by // multithreaded programs like OOo. xmlInitParser(); +#if 0 + // for more debug flags see ne_utils.h; NE_DEBUGGING must be defined + // while compiling neon in order to actually activate neon debug + // output. + ne_debug_init( stderr, NE_DBG_FLUSH + | NE_DBG_HTTP + // | NE_DBG_HTTPBODY + // | NE_DBG_HTTPAUTH + // | NE_DBG_XML + // | NE_DBG_XMLPARSE + // | NE_DBG_LOCKS + ); +#endif m_bGlobalsInited = true; } @@ -747,30 +761,29 @@ void NeonSession::Init() // to the session m_pHttpSession = ne_session_create( - rtl::OUStringToOString( m_aScheme, - RTL_TEXTENCODING_UTF8 ).getStr(), - /* theUri.GetUserInfo(), - @@@ for FTP via HTTP proxy, but not supported by Neon */ - rtl::OUStringToOString( m_aHostName, - RTL_TEXTENCODING_UTF8 ).getStr(), - m_nPort ); + rtl::OUStringToOString( m_aScheme, + RTL_TEXTENCODING_UTF8 ).getStr(), + /* theUri.GetUserInfo(), + @@@ for FTP via HTTP proxy, but not supported by Neon */ + rtl::OUStringToOString( m_aHostName, + RTL_TEXTENCODING_UTF8 ).getStr(), + m_nPort ); if ( m_pHttpSession == 0 ) throw DAVException( DAVException::DAV_SESSION_CREATE, NeonUri::makeConnectionEndPointString( m_aHostName, m_nPort ) ); - if (m_aScheme.equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "https" ) ) ) ) - { - - // Get all trusted certificates from key store - - + // Register the session with the lock store + m_aNeonLockStore.registerSession( m_pHttpSession ); + if ( m_aScheme.equalsIgnoreAsciiCase( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "https" ) ) ) ) + { // Set a failure callback for certificate check - ne_ssl_set_verify( m_pHttpSession, NeonSession_CertificationNotify, this); - } + ne_ssl_set_verify( + m_pHttpSession, NeonSession_CertificationNotify, this); + } // Add hooks (i.e. for adding additional headers to the request) @@ -815,27 +828,20 @@ void NeonSession::Init() if ( m_aProxyName.getLength() ) { ne_session_proxy( m_pHttpSession, - rtl::OUStringToOString( m_aProxyName, - RTL_TEXTENCODING_UTF8 ) - .getStr(), + rtl::OUStringToOString( + m_aProxyName, + RTL_TEXTENCODING_UTF8 ).getStr(), m_nProxyPort ); } - // Note: Uncomment the following if locking support is required - /* - mNeonLockSession = ne_lock_register( m_pHttpSession ); - - if ( mNeonLockSession == NULL ) - throw DAVException( DAVException::DAV_SESSION_CREATE, - theUri::makeConnectionEndPointString() ); - */ - // Register for redirects. ne_redirect_register( m_pHttpSession ); // authentication callbacks. - ne_add_server_auth( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); - ne_add_proxy_auth ( m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_server_auth( + m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); + ne_add_proxy_auth( + m_pHttpSession, NE_AUTH_ALL, NeonSession_NeonAuth, this ); } } @@ -870,15 +876,13 @@ sal_Bool NeonSession::UsesProxy() // OPTIONS // ------------------------------------------------------------------- void NeonSession::OPTIONS( const rtl::OUString & inPath, - DAVCapabilities & outCapabilities, + DAVCapabilities & outCapabilities, const DAVRequestEnvironment & rEnv ) throw( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); HttpServerCapabilities servercaps; memset( &servercaps, 0, sizeof( servercaps ) ); @@ -887,7 +891,8 @@ void NeonSession::OPTIONS( const rtl::OUString & inPath, rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), &servercaps ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); outCapabilities.class1 = !!servercaps.dav_class1; outCapabilities.class2 = !!servercaps.dav_class2; @@ -897,60 +902,58 @@ void NeonSession::OPTIONS( const rtl::OUString & inPath, // ------------------------------------------------------------------- // PROPFIND - allprop & named // ------------------------------------------------------------------- -void NeonSession::PROPFIND( const rtl::OUString & inPath, - const Depth inDepth, +void NeonSession::PROPFIND( const rtl::OUString & inPath, + const Depth inDepth, const std::vector< rtl::OUString > & inPropNames, - std::vector< DAVResource > & ioResources, + std::vector< DAVResource > & ioResources, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); int theRetVal = NE_OK; NeonPropFindRequest theRequest( m_pHttpSession, rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), - inDepth, - inPropNames, - ioResources, - theRetVal ); - HandleError( theRetVal ); + inDepth, + inPropNames, + ioResources, + theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- // PROPFIND - propnames // ------------------------------------------------------------------- -void NeonSession::PROPFIND( const rtl::OUString & inPath, - const Depth inDepth, - std::vector< DAVResourceInfo >& ioResInfo, +void NeonSession::PROPFIND( const rtl::OUString & inPath, + const Depth inDepth, + std::vector< DAVResourceInfo > & ioResInfo, const DAVRequestEnvironment & rEnv ) throw( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); int theRetVal = NE_OK; NeonPropFindRequest theRequest( m_pHttpSession, rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), - inDepth, - ioResInfo, - theRetVal ); - HandleError( theRetVal ); + inDepth, + ioResInfo, + theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- // PROPPATCH // ------------------------------------------------------------------- -void NeonSession::PROPPATCH( const rtl::OUString & inPath, - const std::vector< ProppatchValue > & inValues, +void NeonSession::PROPPATCH( const rtl::OUString & inPath, + const std::vector< ProppatchValue > & inValues, const DAVRequestEnvironment & rEnv ) throw( DAVException ) { @@ -974,9 +977,10 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath, executable w ( #ifndef WIN32 ) All dead properties are of course writable. - */ + */ int theRetVal = NE_OK; + int n; // for the "for" loop // Generate the list of properties we want to set. @@ -1000,8 +1004,8 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath, if ( DAVProperties::isUCBDeadProperty( *pName ) ) { // DAV dead property added by WebDAV UCP? - if ( !UCBDeadPropertyValue::toXML( - rValue.value, aStringValue ) ) + if ( !UCBDeadPropertyValue::toXML( rValue.value, + aStringValue ) ) { // Error! pItems[ n ].value = 0; @@ -1015,7 +1019,7 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath, // complex properties... if ( rValue.name == DAVProperties::SOURCE ) { - uno::Sequence< ::com::sun::star::ucb::Link > aLinks; + uno::Sequence< ucb::Link > aLinks; if ( rValue.value >>= aLinks ) { LinkSequence::toXML( aLinks, aStringValue ); @@ -1055,9 +1059,7 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); pItems[ n ].name = 0; @@ -1076,7 +1078,7 @@ void NeonSession::PROPPATCH( const rtl::OUString & inPath, delete [] pItems; - HandleError( theRetVal ); + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- @@ -1090,9 +1092,7 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); int theRetVal = NE_OK; NeonHeadRequest theRequest( m_pHttpSession, @@ -1100,7 +1100,8 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath, inHeaderNames, ioResource, theRetVal ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- @@ -1108,14 +1109,12 @@ void NeonSession::HEAD( const ::rtl::OUString & inPath, // ------------------------------------------------------------------- uno::Reference< io::XInputStream > NeonSession::GET( const rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream ); NeonRequestContext aCtx( xInputStream ); @@ -1125,23 +1124,23 @@ NeonSession::GET( const rtl::OUString & inPath, NeonSession_ResponseBlockReader, false, &aCtx ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); + return uno::Reference< io::XInputStream >( xInputStream.get() ); } // ------------------------------------------------------------------- // GET // ------------------------------------------------------------------- -void NeonSession::GET( const rtl::OUString & inPath, +void NeonSession::GET( const rtl::OUString & inPath, uno::Reference< io::XOutputStream > & ioOutputStream, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); NeonRequestContext aCtx( ioOutputStream ); int theRetVal = GET( m_pHttpSession, @@ -1150,7 +1149,8 @@ void NeonSession::GET( const rtl::OUString & inPath, NeonSession_ResponseBlockWriter, false, &aCtx ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- @@ -1158,16 +1158,14 @@ void NeonSession::GET( const rtl::OUString & inPath, // ------------------------------------------------------------------- uno::Reference< io::XInputStream > NeonSession::GET( const rtl::OUString & inPath, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); ioResource.uri = inPath; ioResource.properties.clear(); @@ -1180,7 +1178,9 @@ NeonSession::GET( const rtl::OUString & inPath, NeonSession_ResponseBlockReader, true, &aCtx ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); + return uno::Reference< io::XInputStream >( xInputStream.get() ); } @@ -1188,17 +1188,15 @@ NeonSession::GET( const rtl::OUString & inPath, // GET // ------------------------------------------------------------------- void NeonSession::GET( const rtl::OUString & inPath, - uno::Reference< io::XOutputStream > & ioOutputStream, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) + uno::Reference< io::XOutputStream > & ioOutputStream, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); ioResource.uri = inPath; ioResource.properties.clear(); @@ -1210,27 +1208,26 @@ void NeonSession::GET( const rtl::OUString & inPath, NeonSession_ResponseBlockWriter, true, &aCtx ); - HandleError( theRetVal ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- // PUT // ------------------------------------------------------------------- -void NeonSession::PUT( const rtl::OUString & inPath, +void NeonSession::PUT( const rtl::OUString & inPath, const uno::Reference< io::XInputStream > & inInputStream, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; - uno::Sequence< sal_Int8 > aDataToSend; if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) ) throw DAVException( DAVException::DAV_INVALID_ARG ); + Init( rEnv ); + int theRetVal = PUT( m_pHttpSession, rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ), @@ -1238,7 +1235,7 @@ void NeonSession::PUT( const rtl::OUString & inPath, aDataToSend.getConstArray() ), aDataToSend.getLength() ); - HandleError( theRetVal ); + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- @@ -1246,10 +1243,10 @@ void NeonSession::PUT( const rtl::OUString & inPath, // ------------------------------------------------------------------- uno::Reference< io::XInputStream > NeonSession::POST( const rtl::OUString & inPath, - const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const uno::Reference< io::XInputStream > & inInputStream, - const DAVRequestEnvironment & rEnv ) + const rtl::OUString & rContentType, + const rtl::OUString & rReferer, + const uno::Reference< io::XInputStream > & inInputStream, + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); @@ -1258,15 +1255,13 @@ NeonSession::POST( const rtl::OUString & inPath, if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) ) throw DAVException( DAVException::DAV_INVALID_ARG ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); rtl::Reference< NeonInputStream > xInputStream( new NeonInputStream ); NeonRequestContext aCtx( xInputStream ); int theRetVal = POST( m_pHttpSession, rtl::OUStringToOString( - inPath, RTL_TEXTENCODING_UTF8 ), + inPath, RTL_TEXTENCODING_UTF8 ), reinterpret_cast< const char * >( aDataToSend.getConstArray() ), NeonSession_ResponseBlockReader, @@ -1274,7 +1269,8 @@ NeonSession::POST( const rtl::OUString & inPath, rContentType, rReferer ); - HandleError( theRetVal ); + HandleError( theRetVal, inPath, rEnv ); + return uno::Reference< io::XInputStream >( xInputStream.get() ); } @@ -1295,9 +1291,7 @@ void NeonSession::POST( const rtl::OUString & inPath, if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) ) throw DAVException( DAVException::DAV_INVALID_ARG ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); NeonRequestContext aCtx( oOutputStream ); int theRetVal = POST( m_pHttpSession, @@ -1310,20 +1304,7 @@ void NeonSession::POST( const rtl::OUString & inPath, rContentType, rReferer ); - HandleError( theRetVal ); -} - -// ------------------------------------------------------------------- -// ABORT -// ------------------------------------------------------------------- -void NeonSession::ABORT() - throw ( DAVException ) -{ - // 11.11.09 (tkr): The following code lines causing crashes if closing a ongoing connection. It turned out that this existing solution doesn't work in multi-threading environments. - // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3. - - //if (NULL !=m_pHttpSession) - // ne_close_connection(m_pHttpSession); + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- @@ -1335,30 +1316,27 @@ void NeonSession::MKCOL( const rtl::OUString & inPath, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); int theRetVal = ne_mkcol( m_pHttpSession, rtl::OUStringToOString( - inPath, RTL_TEXTENCODING_UTF8 ) ); - HandleError( theRetVal ); + inPath, RTL_TEXTENCODING_UTF8 ) ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- // COPY // ------------------------------------------------------------------- -void NeonSession::COPY( const rtl::OUString & inSourceURL, - const rtl::OUString & inDestinationURL, +void NeonSession::COPY( const rtl::OUString & inSourceURL, + const rtl::OUString & inDestinationURL, const DAVRequestEnvironment & rEnv, - sal_Bool inOverWrite ) + sal_Bool inOverWrite ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); NeonUri theSourceUri( inSourceURL ); NeonUri theDestinationUri( inDestinationURL ); @@ -1367,12 +1345,13 @@ void NeonSession::COPY( const rtl::OUString & inSourceURL, inOverWrite ? 1 : 0, NE_DEPTH_INFINITE, rtl::OUStringToOString( - theSourceUri.GetPath(), - RTL_TEXTENCODING_UTF8 ), + theSourceUri.GetPath(), + RTL_TEXTENCODING_UTF8 ), rtl::OUStringToOString( - theDestinationUri.GetPath(), - RTL_TEXTENCODING_UTF8 ) ); - HandleError( theRetVal ); + theDestinationUri.GetPath(), + RTL_TEXTENCODING_UTF8 ) ); + + HandleError( theRetVal, inSourceURL, rEnv ); } // ------------------------------------------------------------------- @@ -1386,21 +1365,20 @@ void NeonSession::MOVE( const rtl::OUString & inSourceURL, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); NeonUri theSourceUri( inSourceURL ); NeonUri theDestinationUri( inDestinationURL ); int theRetVal = ne_move( m_pHttpSession, inOverWrite ? 1 : 0, rtl::OUStringToOString( - theSourceUri.GetPath(), - RTL_TEXTENCODING_UTF8 ), + theSourceUri.GetPath(), + RTL_TEXTENCODING_UTF8 ), rtl::OUStringToOString( - theDestinationUri.GetPath(), - RTL_TEXTENCODING_UTF8 ) ); - HandleError( theRetVal ); + theDestinationUri.GetPath(), + RTL_TEXTENCODING_UTF8 ) ); + + HandleError( theRetVal, inSourceURL, rEnv ); } // ------------------------------------------------------------------- @@ -1412,53 +1390,282 @@ void NeonSession::DESTROY( const rtl::OUString & inPath, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); - - m_aEnv = rEnv; + Init( rEnv ); int theRetVal = ne_delete( m_pHttpSession, rtl::OUStringToOString( - inPath, RTL_TEXTENCODING_UTF8 ) ); - HandleError( theRetVal ); + inPath, RTL_TEXTENCODING_UTF8 ) ); + + HandleError( theRetVal, inPath, rEnv ); } // ------------------------------------------------------------------- -// LOCK +namespace +{ + sal_Int32 lastChanceToSendRefreshRequest( TimeValue const & rStart, + int timeout ) + { + TimeValue aEnd; + osl_getSystemTime( &aEnd ); + + // Try to estimate a safe absolute time for sending the + // lock refresh request. + sal_Int32 lastChanceToSendRefreshRequest = -1; + if ( timeout != NE_TIMEOUT_INFINITE ) + { + sal_Int32 calltime = aEnd.Seconds - rStart.Seconds; + if ( calltime <= timeout ) + { + lastChanceToSendRefreshRequest + = aEnd.Seconds + timeout - calltime; + } + else + { + OSL_TRACE( "No chance to refresh lock before timeout!" ); + } + } + return lastChanceToSendRefreshRequest; + } + +} // namespace + +// ------------------------------------------------------------------- +// LOCK (set new lock) // ------------------------------------------------------------------- -// Note: Uncomment the following if locking support is required -/* -void NeonSession::LOCK( const Lock & inLock, +void NeonSession::LOCK( const ::rtl::OUString & inPath, + ucb::Lock & rLock, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); + Init( rEnv ); - m_aEnv = rEnv; + /* Create a depth zero, exclusive write lock, with default timeout + * (allowing a server to pick a default). token, owner and uri are + * unset. */ + NeonLock * theLock = ne_lock_create(); + + // Set the lock uri + ne_uri aUri; + ne_uri_parse( rtl::OUStringToOString( makeAbsoluteURL( inPath ), + RTL_TEXTENCODING_UTF8 ).getStr(), + &aUri ); + theLock->uri = aUri; + + // Set the lock depth + switch( rLock.Depth ) + { + case ucb::LockDepth_ZERO: + theLock->depth = NE_DEPTH_ZERO; + break; + case ucb::LockDepth_ONE: + theLock->depth = NE_DEPTH_ONE; + break; + case ucb::LockDepth_INFINITY: + theLock->depth = NE_DEPTH_INFINITE; + break; + default: + throw DAVException( DAVException::DAV_INVALID_ARG ); + } + + // Set the lock scope + switch ( rLock.Scope ) + { + case ucb::LockScope_EXCLUSIVE: + theLock->scope = ne_lockscope_exclusive; + break; + case ucb::LockScope_SHARED: + theLock->scope = ne_lockscope_shared; + break; + default: + throw DAVException( DAVException::DAV_INVALID_ARG ); + } + + // Set the lock timeout + theLock->timeout = (long)rLock.Timeout; + + // Set the lock owner + rtl::OUString aValue; + rLock.Owner >>= aValue; + theLock->owner = + ne_strdup( rtl::OUStringToOString( aValue, + RTL_TEXTENCODING_UTF8 ).getStr() ); + TimeValue startCall; + osl_getSystemTime( &startCall ); + + int theRetVal = ne_lock( m_pHttpSession, theLock ); + + if ( theRetVal == NE_OK ) + { + m_aNeonLockStore.addLock( theLock, + this, + lastChanceToSendRefreshRequest( + startCall, theLock->timeout ) ); + + uno::Sequence< rtl::OUString > aTokens( 1 ); + aTokens[ 0 ] = rtl::OUString::createFromAscii( theLock->token ); + rLock.LockTokens = aTokens; + + OSL_TRACE( "NeonSession::LOCK: created lock for %s. token: %s", + rtl::OUStringToOString( makeAbsoluteURL( inPath ), + RTL_TEXTENCODING_UTF8 ).getStr(), + theLock->token ); + } + else + { + ne_lock_destroy( theLock ); + + OSL_TRACE( "NeonSession::LOCK: obtaining lock for %s failed!", + rtl::OUStringToOString( makeAbsoluteURL( inPath ), + RTL_TEXTENCODING_UTF8 ).getStr() ); + } + + HandleError( theRetVal, inPath, rEnv ); +} + +// ------------------------------------------------------------------- +// LOCK (refresh existing lock) +// ------------------------------------------------------------------- +sal_Int64 NeonSession::LOCK( const ::rtl::OUString & inPath, + sal_Int64 nTimeout, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ) +{ + osl::Guard< osl::Mutex > theGuard( m_aMutex ); + + // Try to get the neon lock from lock store + NeonLock * theLock + = m_aNeonLockStore.findByUri( makeAbsoluteURL( inPath ) ); + if ( !theLock ) + throw DAVException( DAVException::DAV_NOT_LOCKED ); + + Init( rEnv ); + + // refresh existing lock. + theLock->timeout = static_cast< long >( nTimeout ); - Lockit( inLock, true ); + TimeValue startCall; + osl_getSystemTime( &startCall ); + + int theRetVal = ne_lock_refresh( m_pHttpSession, theLock ); + + if ( theRetVal == NE_OK ) + { + m_aNeonLockStore.updateLock( theLock, + lastChanceToSendRefreshRequest( + startCall, theLock->timeout ) ); + } + + HandleError( theRetVal, inPath, rEnv ); + + return theLock->timeout; +} + +// ------------------------------------------------------------------- +// LOCK (refresh existing lock) +// ------------------------------------------------------------------- +bool NeonSession::LOCK( NeonLock * pLock, + sal_Int32 & rlastChanceToSendRefreshRequest ) +{ + osl::Guard< osl::Mutex > theGuard( m_aMutex ); + +#if OSL_DEBUG_LEVEL > 0 + char * p = ne_uri_unparse( &(pLock->uri) ); + OSL_TRACE( "NeonSession::LOCK: Refreshing lock for %s.", p ); + ne_free( p ); +#endif + + // refresh existing lock. + + TimeValue startCall; + osl_getSystemTime( &startCall ); + + if ( ne_lock_refresh( m_pHttpSession, pLock ) == NE_OK ) + { + rlastChanceToSendRefreshRequest + = lastChanceToSendRefreshRequest( startCall, pLock->timeout ); + + OSL_TRACE( "Lock successfully refreshed." ); + return true; + } + else + { + OSL_TRACE( "Lock not refreshed!" ); + return false; + } } -*/ // ------------------------------------------------------------------- // UNLOCK // ------------------------------------------------------------------- -// Note: Uncomment the following if locking support is required -/* -void NeonSession::UNLOCK( const Lock & inLock, +void NeonSession::UNLOCK( const ::rtl::OUString & inPath, const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init(); + // get the neon lock from lock store + NeonLock * theLock + = m_aNeonLockStore.findByUri( makeAbsoluteURL( inPath ) ); + if ( !theLock ) + throw DAVException( DAVException::DAV_NOT_LOCKED ); - m_aEnv = rEnv; + Init( rEnv ); + + int theRetVal = ne_unlock( m_pHttpSession, theLock ); + + if ( theRetVal == NE_OK ) + { + m_aNeonLockStore.removeLock( theLock ); + ne_lock_destroy( theLock ); + } + else + { + OSL_TRACE( "NeonSession::UNLOCK: unlocking of %s failed.", + rtl::OUStringToOString( makeAbsoluteURL( inPath ), + RTL_TEXTENCODING_UTF8 ).getStr() ); + } + + HandleError( theRetVal, inPath, rEnv ); +} + +// ------------------------------------------------------------------- +// UNLOCK +// ------------------------------------------------------------------- +bool NeonSession::UNLOCK( NeonLock * pLock ) +{ + osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Lockit( inLock, false ); +#if OSL_DEBUG_LEVEL > 0 + char * p = ne_uri_unparse( &(pLock->uri) ); + OSL_TRACE( "NeonSession::UNLOCK: Unlocking %s.", p ); + ne_free( p ); +#endif + + if ( ne_unlock( m_pHttpSession, pLock ) == NE_OK ) + { + OSL_TRACE( "UNLOCK succeeded." ); + return true; + } + else + { + OSL_TRACE( "UNLOCK failed!" ); + return false; + } +} + +// ------------------------------------------------------------------- +void NeonSession::abort() + throw ( DAVException ) +{ + // 11.11.09 (tkr): The following code lines causing crashes if + // closing a ongoing connection. It turned out that this existing + // solution doesn't work in multi-threading environments. + // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3. + //if ( m_pHttpSession ) + // ne_close_connection( m_pHttpSession ); } -*/ // ------------------------------------------------------------------- const ucbhelper::InternetProxyServer & NeonSession::getProxySettings() const @@ -1479,10 +1686,98 @@ const ucbhelper::InternetProxyServer & NeonSession::getProxySettings() const } // ------------------------------------------------------------------- +namespace { + +bool containsLocktoken( const uno::Sequence< ucb::Lock > & rLocks, + const char * token ) +{ + for ( sal_Int32 n = 0; n < rLocks.getLength(); ++n ) + { + const uno::Sequence< rtl::OUString > & rTokens + = rLocks[ n ].LockTokens; + for ( sal_Int32 m = 0; m < rTokens.getLength(); ++m ) + { + if ( rTokens[ m ].equalsAscii( token ) ) + return true; + } + } + return false; +} + +} // namespace + +// ------------------------------------------------------------------- +bool NeonSession::removeExpiredLocktoken( const rtl::OUString & inURL, + const DAVRequestEnvironment & rEnv ) +{ + NeonLock * theLock = m_aNeonLockStore.findByUri( inURL ); + if ( !theLock ) + return false; + + // do a lockdiscovery to check whether this lock is still valid. + try + { + // @@@ Alternative: use ne_lock_discover() => less overhead + + std::vector< DAVResource > aResources; + std::vector< rtl::OUString > aPropNames; + aPropNames.push_back( DAVProperties::LOCKDISCOVERY ); + + PROPFIND( rEnv.m_aRequestURI, DAVZERO, aPropNames, aResources, rEnv ); + + if ( aResources.size() == 0 ) + return false; + + std::vector< DAVPropertyValue >::const_iterator it + = aResources[ 0 ].properties.begin(); + std::vector< DAVPropertyValue >::const_iterator end + = aResources[ 0 ].properties.end(); + + while ( it != end ) + { + if ( (*it).Name.equals( DAVProperties::LOCKDISCOVERY ) ) + { + uno::Sequence< ucb::Lock > aLocks; + if ( !( (*it).Value >>= aLocks ) ) + return false; + + if ( !containsLocktoken( aLocks, theLock->token ) ) + { + // expired! + break; + } + + // still valid. + return false; + } + ++it; + } + + // No lockdiscovery prop in propfind result / locktoken not found + // in propfind result -> not locked + OSL_TRACE( "NeonSession::removeExpiredLocktoken: Removing " + " expired lock token for %s. token: %s", + rtl::OUStringToOString( inURL, + RTL_TEXTENCODING_UTF8 ).getStr(), + theLock->token ); + + m_aNeonLockStore.removeLock( theLock ); + ne_lock_destroy( theLock ); + return true; + } + catch ( DAVException const & ) + { + } + return false; +} + +// ------------------------------------------------------------------- // HandleError // Common Error Handler // ------------------------------------------------------------------- -void NeonSession::HandleError( int nError ) +void NeonSession::HandleError( int nError, + const rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) throw ( DAVException ) { m_aEnv = DAVRequestEnvironment(); @@ -1491,60 +1786,84 @@ void NeonSession::HandleError( int nError ) switch ( nError ) { case NE_OK: - // Cleanup. return; case NE_ERROR: // Generic error { rtl::OUString aText = rtl::OUString::createFromAscii( - ne_get_error( m_pHttpSession ) ); - throw DAVException( DAVException::DAV_HTTP_ERROR, - aText, - makeStatusCode( aText ) ); - } + ne_get_error( m_pHttpSession ) ); + + sal_uInt16 code = makeStatusCode( aText ); + + if ( code == SC_LOCKED ) + { + if ( m_aNeonLockStore.findByUri( + makeAbsoluteURL( inPath ) ) == 0 ) + { + // locked by 3rd party + throw DAVException( DAVException::DAV_LOCKED ); + } + else + { + // locked by ourself + throw DAVException( DAVException::DAV_LOCKED_SELF ); + } + } + + // Special handling for 400 and 412 status codes, which may indicate + // that a lock previously obtained by us has been released meanwhile + // by the server. Unfortunately, RFC is not clear at this point, + // thus server implementations behave different... + else if ( code == SC_BAD_REQUEST || code == SC_PRECONDITION_FAILED ) + { + if ( removeExpiredLocktoken( makeAbsoluteURL( inPath ), rEnv ) ) + throw DAVException( DAVException::DAV_LOCK_EXPIRED ); + } + throw DAVException( DAVException::DAV_HTTP_ERROR, aText, code ); + } case NE_LOOKUP: // Name lookup failed. throw DAVException( DAVException::DAV_HTTP_LOOKUP, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_AUTH: // User authentication failed on server throw DAVException( DAVException::DAV_HTTP_AUTH, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_PROXYAUTH: // User authentication failed on proxy throw DAVException( DAVException::DAV_HTTP_AUTHPROXY, NeonUri::makeConnectionEndPointString( - m_aProxyName, m_nProxyPort ) ); + m_aProxyName, m_nProxyPort ) ); case NE_CONNECT: // Could not connect to server throw DAVException( DAVException::DAV_HTTP_CONNECT, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_TIMEOUT: // Connection timed out throw DAVException( DAVException::DAV_HTTP_TIMEOUT, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_FAILED: // The precondition failed throw DAVException( DAVException::DAV_HTTP_FAILED, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_RETRY: // Retry request (ne_end_request ONLY) throw DAVException( DAVException::DAV_HTTP_RETRY, NeonUri::makeConnectionEndPointString( - m_aHostName, m_nPort ) ); + m_aHostName, m_nPort ) ); case NE_REDIRECT: { NeonUri aUri( ne_redirect_location( m_pHttpSession ) ); throw DAVException( - DAVException::DAV_HTTP_REDIRECT, aUri.GetURI() ); + DAVException::DAV_HTTP_REDIRECT, aUri.GetURI() ); } - default: + default: { OSL_TRACE( "NeonSession::HandleError : Unknown Neon error code!" ); throw DAVException( DAVException::DAV_HTTP_ERROR, @@ -1554,78 +1873,6 @@ void NeonSession::HandleError( int nError ) } } -// Note: Uncomment the following if locking support is required -/* -void NeonSession::Lockit( const Lock & inLock, bool inLockit ) - throw ( DAVException ) -{ - osl::Guard< osl::Mutex > theGuard( m_aMutex ); - - // Create the neon lock - NeonLock * theLock = new NeonLock; - int theRetVal; - - // Set the lock uri - NeonUri theUri( inLock.uri ); - theLock->uri = const_cast< char * > - ( rtl::OUStringToOString( - theUri.GetPath(), RTL_TEXTENCODING_UTF8 ).getStr() ); - - if ( inLockit ) - { - // Set the lock depth - switch( inLock.depth ) - { - case DAVZERO: - case DAVINFINITY: - theLock->depth = int ( inLock.depth ); - break; - default: - throw DAVException( DAVException::DAV_INVALID_ARG ); - break; - } - - // Set the lock scope - switch ( inLock.scope ) - { - case EXCLUSIVE: - theLock->scope = ne_lockscope_exclusive; - break; - case SHARED: - theLock->scope = ne_lockscope_shared; - break; - default: - throw DAVException( DAVException::DAV_INVALID_ARG ); - break; - } - - // Set the lock owner - const char * theOwner = rtl::OUStringToOString( inLock.owner, - RTL_TEXTENCODING_UTF8 ); - theLock->owner = const_cast< char * > ( theOwner ); - - // Set the lock timeout - // Note: Neon ignores the timeout - //theLock->timeout = inLock.timeout; - - theRetVal = ne_lock( m_pHttpSession, theLock ); - } - else - { - - // Set the lock token - rtl::OUString theToken = inLock.locktoken.getConstArray()[ 0 ]; - theLock->token = const_cast< char * > - ( rtl::OUStringToOString( - theToken, RTL_TEXTENCODING_UTF8 ).getStr() ); - - theRetVal = ne_unlock( m_pHttpSession, theLock ); - } - - HandleError( theRetVal ); -} -*/ - // ------------------------------------------------------------------- namespace { @@ -1702,22 +1949,23 @@ int NeonSession::GET( ne_session * sess, #if NEON_VERSION < 0x0250 if ( getheaders ) - ne_add_response_header_catcher( req, runResponseHeaderHandler, userdata ); + ne_add_response_header_catcher( + req, runResponseHeaderHandler, userdata ); #endif - ne_add_response_body_reader( req, ne_accept_2xx, reader, userdata ); + ne_decompress * dc + = ne_decompress_reader( req, ne_accept_2xx, reader, userdata ); ret = ne_request_dispatch( req ); #if NEON_VERSION >= 0x0250 if ( getheaders ) { - while ((cursor = ne_response_header_iterate(req, cursor, &name, &value)) - != NULL) + while ( ( cursor = ne_response_header_iterate( + req, cursor, &name, &value ) ) != NULL ) { char buffer[8192]; ne_snprintf(buffer, sizeof buffer, "%s: %s", name, value); - runResponseHeaderHandler(userdata, buffer); } } @@ -1725,6 +1973,9 @@ int NeonSession::GET( ne_session * sess, if ( ret == NE_OK && ne_get_status( req )->klass != 2 ) ret = NE_ERROR; + if ( dc != 0 ) + ne_decompress_destroy(dc); + ne_request_destroy( req ); return ret; } @@ -1812,10 +2063,11 @@ int NeonSession::POST( ne_session * sess, // ------------------------------------------------------------------- // static -bool NeonSession::getDataFromInputStream( - const uno::Reference< io::XInputStream > & xStream, - uno::Sequence< sal_Int8 > & rData, - bool bAppendTrailingZeroByte ) +bool +NeonSession::getDataFromInputStream( + const uno::Reference< io::XInputStream > & xStream, + uno::Sequence< sal_Int8 > & rData, + bool bAppendTrailingZeroByte ) { if ( xStream.is() ) { @@ -1898,32 +2150,56 @@ bool NeonSession::getDataFromInputStream( } return false; } -// ------------------------------------------------------------------- -//static - -NeonSession::Map NeonSession::certMap; // --------------------------------------------------------------------- sal_Bool -NeonSession::isDomainMatch( rtl::OUString certHostName) +NeonSession::isDomainMatch( rtl::OUString certHostName ) { rtl::OUString hostName = getHostName(); - if (hostName.equalsIgnoreAsciiCase( certHostName )) + if (hostName.equalsIgnoreAsciiCase( certHostName ) ) return sal_True; - - - if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) && hostName.getLength() >= certHostName.getLength() ) + if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) && + hostName.getLength() >= certHostName.getLength() ) { rtl::OUString cmpStr = certHostName.copy( 1 ); - if ( hostName.matchIgnoreAsciiCase( cmpStr, hostName.getLength( ) - cmpStr.getLength()) ) + if ( hostName.matchIgnoreAsciiCase( + cmpStr, hostName.getLength() - cmpStr.getLength() ) ) return sal_True; - } - return sal_False; } - +// --------------------------------------------------------------------- +rtl::OUString NeonSession::makeAbsoluteURL( rtl::OUString const & rURL ) const +{ + try + { + // Is URL relative or already absolute? + if ( rURL[ 0 ] != sal_Unicode( '/' ) ) + { + // absolute. + return rtl::OUString( rURL ); + } + else + { + ne_uri aUri; + memset( &aUri, 0, sizeof( aUri ) ); + + ne_fill_server_uri( m_pHttpSession, &aUri ); + aUri.path + = ne_strdup( rtl::OUStringToOString( + rURL, RTL_TEXTENCODING_UTF8 ).getStr() ); + NeonUri aNeonUri( &aUri ); + ne_uri_free( &aUri ); + return aNeonUri.GetURI(); + } + } + catch ( DAVException const & ) + { + } + // error. + return rtl::OUString(); +} diff --git a/ucb/source/ucp/webdav/NeonSession.hxx b/ucb/source/ucp/webdav/NeonSession.hxx index 263169ae452a..65c2c25e4ec9 100644 --- a/ucb/source/ucp/webdav/NeonSession.hxx +++ b/ucb/source/ucp/webdav/NeonSession.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonSession.hxx,v $ - * $Revision: 1.31.12.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,10 +32,9 @@ #include <osl/mutex.hxx> #include "DAVSession.hxx" #include "NeonTypes.hxx" +#include "NeonLockStore.hxx" #include <com/sun/star/lang/XMultiServiceFactory.hpp> -using namespace com::sun::star; - namespace ucbhelper { class ProxyDecider; } namespace webdav_ucp @@ -51,236 +47,249 @@ namespace webdav_ucp class NeonSession : public DAVSession { - private: - osl::Mutex m_aMutex; - static osl::Mutex m_aGlobalMutex; - rtl::OUString m_aScheme; - rtl::OUString m_aHostName; - rtl::OUString m_aProxyName; - sal_Int32 m_nPort; - sal_Int32 m_nProxyPort; - HttpSession * m_pHttpSession; - void * m_pRequestData; - const ucbhelper::InternetProxyDecider & m_rProxyDecider; - - // @@@ This should really be per-request data. But Neon currently - // (0.23.5) has no interface for passing per-request user data. - // Theoretically, a NeonSession instance could handle multiple requests - // at a time --currently it doesn't. Thus this is not an issue at the - // moment. - DAVRequestEnvironment m_aEnv; - - // Note: Uncomment the following if locking support is required - // NeonLockSession * mNeonLockSession; - - static bool m_bGlobalsInited; - - protected: - virtual ~NeonSession(); - - public: - NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory, - const rtl::OUString& inUri, - const ucbhelper::InternetProxyDecider & rProxyDecider ) - throw ( DAVException ); - - // DAVSession methods - virtual sal_Bool CanUse( const ::rtl::OUString & inUri ); - - virtual sal_Bool UsesProxy(); - - const DAVRequestEnvironment & getRequestEnvironment() const - { return m_aEnv; } - - virtual void - OPTIONS( const ::rtl::OUString & inPath, - DAVCapabilities & outCapabilities, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - // allprop & named - virtual void - PROPFIND( const ::rtl::OUString & inPath, - const Depth inDepth, - const std::vector< ::rtl::OUString > & inPropNames, - std::vector< DAVResource > & ioResources, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - // propnames - virtual void - PROPFIND( const ::rtl::OUString & inPath, - const Depth inDepth, - std::vector< DAVResourceInfo >& ioResInfo, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void - PROPPATCH( const ::rtl::OUString & inPath, - const std::vector< ProppatchValue > & inValues, - const DAVRequestEnvironment & rEnv ) - throw( DAVException ); - - virtual void - HEAD( const ::rtl::OUString & inPath, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) - throw( DAVException ); - - virtual com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > - GET( const ::rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void - GET( const ::rtl::OUString & inPath, - com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & ioOutputStream, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > - GET( const ::rtl::OUString & inPath, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void - GET( const ::rtl::OUString & inPath, - com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & ioOutputStream, - const std::vector< ::rtl::OUString > & inHeaderNames, - DAVResource & ioResource, +private: + osl::Mutex m_aMutex; + rtl::OUString m_aScheme; + rtl::OUString m_aHostName; + rtl::OUString m_aProxyName; + sal_Int32 m_nPort; + sal_Int32 m_nProxyPort; + HttpSession * m_pHttpSession; + void * m_pRequestData; + const ucbhelper::InternetProxyDecider & m_rProxyDecider; + + // @@@ This should really be per-request data. But Neon currently + // (0.23.5) has no interface for passing per-request user data. + // Theoretically, a NeonSession instance could handle multiple requests + // at a time --currently it doesn't. Thus this is not an issue at the + // moment. + DAVRequestEnvironment m_aEnv; + + static bool m_bGlobalsInited; + static osl::Mutex m_aGlobalMutex; + static NeonLockStore m_aNeonLockStore; + +protected: + virtual ~NeonSession(); + +public: + NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory, + const rtl::OUString& inUri, + const ucbhelper::InternetProxyDecider & rProxyDecider ) + throw ( DAVException ); + + // DAVSession methods + virtual sal_Bool CanUse( const ::rtl::OUString & inUri ); + + virtual sal_Bool UsesProxy(); + + const DAVRequestEnvironment & getRequestEnvironment() const + { return m_aEnv; } + + virtual void + OPTIONS( const ::rtl::OUString & inPath, + DAVCapabilities & outCapabilities, const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void - PUT( const ::rtl::OUString & inPath, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & inInputStream, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > - POST( const rtl::OUString & inPath, - const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & inInputStream, + throw ( DAVException ); + + // allprop & named + virtual void + PROPFIND( const ::rtl::OUString & inPath, + const Depth inDepth, + const std::vector< ::rtl::OUString > & inPropNames, + std::vector< DAVResource > & ioResources, const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); + throw ( DAVException ); - virtual void - POST( const rtl::OUString & inPath, - const rtl::OUString & rContentType, - const rtl::OUString & rReferer, - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & inInputStream, - com::sun::star::uno::Reference< - com::sun::star::io::XOutputStream > & oOutputStream, + // propnames + virtual void + PROPFIND( const ::rtl::OUString & inPath, + const Depth inDepth, + std::vector< DAVResourceInfo >& ioResInfo, const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); + throw ( DAVException ); - virtual void - MKCOL( const ::rtl::OUString & inPath, + virtual void + PROPPATCH( const ::rtl::OUString & inPath, + const std::vector< ProppatchValue > & inValues, const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void - COPY( const ::rtl::OUString & inSourceURL, - const ::rtl::OUString & inDestinationURL, - const DAVRequestEnvironment & rEnv, - sal_Bool inOverWrite ) - throw ( DAVException ); - - virtual void - MOVE( const ::rtl::OUString & inSourceURL, - const ::rtl::OUString & inDestinationURL, - const DAVRequestEnvironment & rEnv, - sal_Bool inOverWrite ) - throw ( DAVException ); - - virtual void DESTROY( const ::rtl::OUString & inPath, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void ABORT() - throw ( DAVException ); - - // Note: Uncomment the following if locking support is required - /* - virtual void LOCK (const Lock & inLock, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - - virtual void UNLOCK (const Lock & inLock, - const DAVRequestEnvironment & rEnv ) - throw ( DAVException ); - */ - - // helpers - const rtl::OUString & getHostName() const { return m_aHostName; } - - const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF() { return m_xFactory->getServiceFactory(); } - - const void * getRequestData() const { return m_pRequestData; } - - sal_Bool isDomainMatch( rtl::OUString certHostName ); - - private: - // Initialise "Neon sockets" - void Init( void ) - throw ( DAVException ); - - void HandleError( int nError ) - throw ( DAVException ); - - const ucbhelper::InternetProxyServer & getProxySettings() const; - - // Note: Uncomment the following if locking support is required - // void Lockit( const Lock & inLock, bool inLockit ) - // throw ( DAVException ); - - // low level GET implementation, used by public GET implementations - static int GET( ne_session * sess, - const char * uri, - ne_block_reader reader, - bool getheaders, - void * userdata ); - - // Buffer-based PUT implementation. Neon only has file descriptor- - // based API. - static int PUT( ne_session * sess, - const char * uri, - const char * buffer, - size_t size ); - - // Buffer-based POST implementation. Neon only has file descriptor- - // based API. - int POST( ne_session * sess, - const char * uri, - const char * buffer, - ne_block_reader reader, - void * userdata, - const rtl::OUString & rContentType, - const rtl::OUString & rReferer ); - - // Helper: XInputStream -> Sequence< sal_Int8 > - static bool getDataFromInputStream( - const com::sun::star::uno::Reference< - com::sun::star::io::XInputStream > & xStream, - com::sun::star::uno::Sequence< sal_Int8 > & rData, - bool bAppendTrailingZeroByte ); - - typedef std::map< ::rtl::OUString, ::rtl::OUString > Map; - static Map certMap; + throw ( DAVException ); + + virtual void + HEAD( const ::rtl::OUString & inPath, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + GET( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + GET( const ::rtl::OUString & inPath, + com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > & ioOutputStream, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + GET( const ::rtl::OUString & inPath, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + GET( const ::rtl::OUString & inPath, + com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > & ioOutputStream, + const std::vector< ::rtl::OUString > & inHeaderNames, + DAVResource & ioResource, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + PUT( const ::rtl::OUString & inPath, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & inInputStream, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > + POST( const rtl::OUString & inPath, + const rtl::OUString & rContentType, + const rtl::OUString & rReferer, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & inInputStream, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + POST( const rtl::OUString & inPath, + const rtl::OUString & rContentType, + const rtl::OUString & rReferer, + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & inInputStream, + com::sun::star::uno::Reference< + com::sun::star::io::XOutputStream > & oOutputStream, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + MKCOL( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void + COPY( const ::rtl::OUString & inSourceURL, + const ::rtl::OUString & inDestinationURL, + const DAVRequestEnvironment & rEnv, + sal_Bool inOverWrite ) + throw ( DAVException ); + + virtual void + MOVE( const ::rtl::OUString & inSourceURL, + const ::rtl::OUString & inDestinationURL, + const DAVRequestEnvironment & rEnv, + sal_Bool inOverWrite ) + throw ( DAVException ); + + virtual void DESTROY( const ::rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + // set new lock. + virtual void LOCK( const ::rtl::OUString & inURL, + com::sun::star::ucb::Lock & inLock, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + // refresh existing lock. + virtual sal_Int64 LOCK( const ::rtl::OUString & inURL, + sal_Int64 nTimeout, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + virtual void UNLOCK( const ::rtl::OUString & inURL, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + // helpers + virtual void abort() + throw ( DAVException ); + + const rtl::OUString & getHostName() const { return m_aHostName; } + + const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF() + { return m_xFactory->getServiceFactory(); } + + const void * getRequestData() const { return m_pRequestData; } + + sal_Bool isDomainMatch( rtl::OUString certHostName ); + +private: + friend class NeonLockStore; + + void Init( void ) + throw ( DAVException ); + + void Init( const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + // ret: true => retry request. + void HandleError( int nError, + const rtl::OUString & inPath, + const DAVRequestEnvironment & rEnv ) + throw ( DAVException ); + + const ucbhelper::InternetProxyServer & getProxySettings() const; + + bool removeExpiredLocktoken( const rtl::OUString & inURL, + const DAVRequestEnvironment & rEnv ); + + // refresh lock, called by NeonLockStore::refreshLocks + bool LOCK( NeonLock * pLock, + sal_Int32 & rlastChanceToSendRefreshRequest ); + + // unlock, called by NeonLockStore::~NeonLockStore + bool UNLOCK( NeonLock * pLock ); + + // low level GET implementation, used by public GET implementations + static int GET( ne_session * sess, + const char * uri, + ne_block_reader reader, + bool getheaders, + void * userdata ); + + // Buffer-based PUT implementation. Neon only has file descriptor- + // based API. + static int PUT( ne_session * sess, + const char * uri, + const char * buffer, + size_t size ); + + // Buffer-based POST implementation. Neon only has file descriptor- + // based API. + int POST( ne_session * sess, + const char * uri, + const char * buffer, + ne_block_reader reader, + void * userdata, + const rtl::OUString & rContentType, + const rtl::OUString & rReferer ); + + // Helper: XInputStream -> Sequence< sal_Int8 > + static bool getDataFromInputStream( + const com::sun::star::uno::Reference< + com::sun::star::io::XInputStream > & xStream, + com::sun::star::uno::Sequence< sal_Int8 > & rData, + bool bAppendTrailingZeroByte ); + + rtl::OUString makeAbsoluteURL( rtl::OUString const & rURL ) const; }; -} // namespace_ucp +} // namespace webdav_ucp #endif // _NEONSESSION_HXX_ diff --git a/ucb/source/ucp/webdav/NeonTypes.hxx b/ucb/source/ucp/webdav/NeonTypes.hxx index 2e97af4c963b..21902f352691 100644 --- a/ucb/source/ucp/webdav/NeonTypes.hxx +++ b/ucb/source/ucp/webdav/NeonTypes.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonTypes.hxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,6 +32,7 @@ #include <ne_utils.h> #include <ne_basic.h> #include <ne_props.h> +#include <ne_locks.h> typedef ne_session HttpSession; typedef ne_status HttpStatus; @@ -43,4 +41,6 @@ typedef ne_server_capabilities HttpServerCapabilities; typedef ne_propname NeonPropName; typedef ne_prop_result_set NeonPropFindResultSet; +typedef struct ne_lock NeonLock; + #endif // _NEONTYPES_HXX_ diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx index 5c49179f6b20..f71056ba83a9 100644 --- a/ucb/source/ucp/webdav/NeonUri.cxx +++ b/ucb/source/ucp/webdav/NeonUri.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonUri.cxx,v $ - * $Revision: 1.25.16.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,11 +39,6 @@ using namespace webdav_ucp; - char *scheme; - char *host, *userinfo; - unsigned int port; - char *path, *query, *fragment; - # if defined __SUNPRO_CC // FIXME: not sure whether initializing a ne_uri statically is supposed to work // the string fields of ne_uri are char*, not const char* diff --git a/ucb/source/ucp/webdav/NeonUri.hxx b/ucb/source/ucp/webdav/NeonUri.hxx index 0ea848d4ae92..c83ca47d5a1c 100644 --- a/ucb/source/ucp/webdav/NeonUri.hxx +++ b/ucb/source/ucp/webdav/NeonUri.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NeonUri.hxx,v $ - * $Revision: 1.14.22.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/PropertyMap.hxx b/ucb/source/ucp/webdav/PropertyMap.hxx index 98f42c07da82..624187b1746e 100644 --- a/ucb/source/ucp/webdav/PropertyMap.hxx +++ b/ucb/source/ucp/webdav/PropertyMap.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: PropertyMap.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx index cd03d5b76a9d..1ce4c70e6b21 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: UCBDeadPropertyValue.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -89,12 +86,11 @@ const rtl::OUString UCBDeadPropertyValue::aXMLEnd extern "C" int UCBDeadPropertyValue_startelement_callback( void *, int parent, - const char *nspace, + const char * /*nspace*/, const char *name, const char ** ) { - if ( ( name != 0 ) && - ( ( nspace == 0 ) || ( strcmp( nspace, "" ) == 0 ) ) ) + if ( name != 0 ) { switch ( parent ) { @@ -187,7 +183,7 @@ static rtl::OUString encodeValue( const rtl::OUString & rValue ) // PROPPATCH: // - Encoded property value: x<z // - UCBDeadPropertyValue::toXML result: - // <ucbprop><type>string</type><value>x<z</value></ucbprop> + // <ucbprop><type>string</type><value>x<z</value></ucbprop> // PROPFIND: // - parser replaces < by > ==> error (not well formed) @@ -361,7 +357,7 @@ bool UCBDeadPropertyValue::supportsType( const uno::Type & rType ) ////////////////////////////////////////////////////////////////////////// // static bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData, - uno::Any & rOutData ) + uno::Any & rOutData ) { bool success = false; @@ -450,7 +446,7 @@ bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData, ////////////////////////////////////////////////////////////////////////// // static bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, - rtl::OUString & rOutData ) + rtl::OUString & rOutData ) { // <ucbprop><type>the_type</type><value>the_value</value></ucbprop> @@ -541,7 +537,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, // Encode value! It must not contain XML reserved chars! aStringValue = encodeValue( aStringValue ); - rOutData = aXMLPre; + rOutData = aXMLPre; rOutData += aStringType; rOutData += aXMLMid; rOutData += aStringValue; diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx index 6796b1b8c026..69dc5d3c80bf 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: UCBDeadPropertyValue.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/makefile.mk b/ucb/source/ucp/webdav/makefile.mk index c8891723cd2c..551efb6f06b8 100644 --- a/ucb/source/ucp/webdav/makefile.mk +++ b/ucb/source/ucp/webdav/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.43 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -87,25 +83,26 @@ CFLAGS+= $(OPENSSL_CFLAGS) # --- General ----------------------------------------------------- SLOFILES=\ - $(SLO)$/webdavservices.obj \ - $(SLO)$/webdavprovider.obj \ - $(SLO)$/webdavcontent.obj \ - $(SLO)$/webdavcontentcaps.obj \ - $(SLO)$/webdavresultset.obj \ - $(SLO)$/webdavdatasupplier.obj \ - $(SLO)$/ContentProperties.obj \ - $(SLO)$/DAVProperties.obj \ - $(SLO)$/DAVSessionFactory.obj \ - $(SLO)$/DAVResourceAccess.obj \ - $(SLO)$/NeonUri.obj \ - $(SLO)$/NeonInputStream.obj \ - $(SLO)$/NeonPropFindRequest.obj \ - $(SLO)$/NeonHeadRequest.obj \ - $(SLO)$/NeonSession.obj \ - $(SLO)$/DateTimeHelper.obj \ - $(SLO)$/LinkSequence.obj \ - $(SLO)$/LockSequence.obj \ - $(SLO)$/LockEntrySequence.obj \ + $(SLO)$/webdavservices.obj \ + $(SLO)$/webdavprovider.obj \ + $(SLO)$/webdavcontent.obj \ + $(SLO)$/webdavcontentcaps.obj \ + $(SLO)$/webdavresultset.obj \ + $(SLO)$/webdavdatasupplier.obj \ + $(SLO)$/ContentProperties.obj \ + $(SLO)$/DAVProperties.obj \ + $(SLO)$/DAVSessionFactory.obj \ + $(SLO)$/DAVResourceAccess.obj \ + $(SLO)$/NeonUri.obj \ + $(SLO)$/NeonInputStream.obj \ + $(SLO)$/NeonPropFindRequest.obj \ + $(SLO)$/NeonHeadRequest.obj \ + $(SLO)$/NeonSession.obj \ + $(SLO)$/NeonLockStore.obj \ + $(SLO)$/DateTimeHelper.obj \ + $(SLO)$/LinkSequence.obj \ + $(SLO)$/LockSequence.obj \ + $(SLO)$/LockEntrySequence.obj \ $(SLO)$/UCBDeadPropertyValue.obj LIB1TARGET=$(SLB)$/_$(TARGET).lib @@ -119,17 +116,15 @@ SHL1IMPLIB=i$(TARGET) SHL1VERSIONMAP=exports.map SHL1STDLIBS=\ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(NEON3RDLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ + $(NEON3RDLIB) \ $(LIBXML2LIB) - - .IF "$(GUI)"=="WNT" SHL1STDLIBS+= $(WSOCK32LIB) .IF "$(WINDOWS_VISTA_PSDK)" != "" @@ -150,8 +145,6 @@ SHL1STDLIBS+= $(OPENSSLLIBST) .ENDIF .ENDIF # WNT - - SHL1DEF=$(MISC)$/$(SHL1TARGET).def SHL1LIBS=$(LIB1TARGET) @@ -165,4 +158,3 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------------------------------- .INCLUDE: target.mk - diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index afe2f2d3a7a8..26b2a044e7b6 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavcontent.cxx,v $ - * $Revision: 1.65.12.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -36,13 +33,16 @@ ************************************************************************** *************************************************************************/ -#include <osl/diagnose.h> +#include <osl/diagnose.h> #include "osl/doublecheckedlocking.h" #include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> -#include "com/sun/star/task/XPasswordContainer.hpp" -#include "com/sun/star/task/NoMasterException.hpp" +#include <ucbhelper/contentidentifier.hxx> +#include <ucbhelper/propertyvalueset.hxx> +#include <ucbhelper/simpleinteractionrequest.hxx> +#include <ucbhelper/cancelcommandexecution.hxx> + #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertySetInfoChange.hpp> #include <com/sun/star/beans/PropertySetInfoChangeEvent.hpp> @@ -50,39 +50,37 @@ #include <com/sun/star/io/XActiveDataSink.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/lang/IllegalAccessException.hpp> -#include "com/sun/star/ucb/AuthenticationRequest.hpp" +#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp> +#include <com/sun/star/ucb/CommandEnvironment.hpp> #include <com/sun/star/ucb/CommandFailedException.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEBADTRANSFRERURLEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveBadTransferURLException.hpp> -#endif #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> +#include "com/sun/star/ucb/InteractiveLockingLockedException.hpp" +#include "com/sun/star/ucb/InteractiveLockingLockExpiredException.hpp" +#include "com/sun/star/ucb/InteractiveLockingNotLockedException.hpp" #include <com/sun/star/ucb/InteractiveNetworkConnectException.hpp> -#ifndef _COM_SUN_STAR_UCB_INTERACTIVENETWORKGENBERALEXCEPTION_HPP_ #include <com/sun/star/ucb/InteractiveNetworkGeneralException.hpp> -#endif #include <com/sun/star/ucb/InteractiveNetworkReadException.hpp> #include <com/sun/star/ucb/InteractiveNetworkResolveNameException.hpp> #include <com/sun/star/ucb/InteractiveNetworkWriteException.hpp> +#include <com/sun/star/ucb/MissingInputStreamException.hpp> +#include <com/sun/star/ucb/MissingPropertiesException.hpp> #include <com/sun/star/ucb/NameClash.hpp> #include <com/sun/star/ucb/NameClashException.hpp> #include <com/sun/star/ucb/OpenCommandArgument2.hpp> #include <com/sun/star/ucb/OpenMode.hpp> #include <com/sun/star/ucb/PostCommandArgument2.hpp> #include <com/sun/star/ucb/TransferInfo.hpp> -#include <com/sun/star/ucb/XCommandInfo.hpp> -#include <com/sun/star/ucb/XPersistentPropertySet.hpp> -#include <com/sun/star/ucb/MissingInputStreamException.hpp> -#include <com/sun/star/ucb/MissingPropertiesException.hpp> #include <com/sun/star/ucb/UnsupportedCommandException.hpp> #include <com/sun/star/ucb/UnsupportedDataSinkException.hpp> #include <com/sun/star/ucb/UnsupportedNameClashException.hpp> #include <com/sun/star/ucb/UnsupportedOpenModeException.hpp> -#include <ucbhelper/contentidentifier.hxx> -#include <ucbhelper/propertyvalueset.hxx> -#include <ucbhelper/simpleinteractionrequest.hxx> -#include <ucbhelper/cancelcommandexecution.hxx> +#include <com/sun/star/ucb/XCommandInfo.hpp> +#include <com/sun/star/ucb/XPersistentPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + #include "webdavcontent.hxx" #include "webdavprovider.hxx" #include "webdavresultset.hxx" @@ -96,250 +94,6 @@ using namespace webdav_ucp; //========================================================================= //========================================================================= // -// CommandEnvironment_Impl Implementation. -// -//========================================================================= -//========================================================================= - -class CommandEnvironment_Impl : public cppu::OWeakObject, - public ucb::XCommandEnvironment, - public task::XInteractionHandler -{ -public: - - CommandEnvironment_Impl( - const uno::Reference< lang::XMultiServiceFactory >& xSMgr ) - : m_xSMgr( xSMgr ) - { - } - - // XInterface - XINTERFACE_DECL() - - // XCommandEnvironment - virtual uno::Reference< task::XInteractionHandler > SAL_CALL - getInteractionHandler( ) - throw (uno::RuntimeException) - { - return this; - } - - virtual uno::Reference< ucb::XProgressHandler > SAL_CALL - getProgressHandler( ) - throw (uno::RuntimeException) - { - return 0; - } - - // XInteractionHandler - virtual void SAL_CALL - handle( const uno::Reference< task::XInteractionRequest >& Request ) - throw (uno::RuntimeException); - -private: - - void - handleAuthenticationRequest( - ucb::AuthenticationRequest const&, - uno::Sequence< uno::Reference< task::XInteractionContinuation > > const&) - SAL_THROW((uno::RuntimeException)) - { - } - - uno::Reference< lang::XMultiServiceFactory > m_xSMgr; -}; - -//========================================================================= -void SAL_CALL CommandEnvironment_Impl::acquire() - throw() -{ - OWeakObject::acquire(); -} - -//========================================================================= -void SAL_CALL CommandEnvironment_Impl::release() - throw() -{ - OWeakObject::release(); -} - -//========================================================================= -uno::Any SAL_CALL CommandEnvironment_Impl::queryInterface( - const uno::Type & rType ) - throw( uno::RuntimeException ) -{ - uno::Any aRet = cppu::queryInterface( - rType, - static_cast< ucb::XCommandEnvironment * >( this ), - static_cast< task::XInteractionHandler * >( this ) ); - return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); -} - -//========================================================================= -void SAL_CALL CommandEnvironment_Impl::handle( - const uno::Reference< task::XInteractionRequest >& rIRequest ) - throw (uno::RuntimeException) -{ - if (!rIRequest.is()) - return; - - uno::Any aAnyRequest(rIRequest->getRequest()); - - ucb::AuthenticationRequest rRequest; - if (!(aAnyRequest >>= rRequest)) - return; - - uno::Sequence< uno::Reference< task::XInteractionContinuation > > - rContinuations = rIRequest->getContinuations(); - - // get continuations - uno::Reference< task::XInteractionRetry > xRetry; - uno::Reference< task::XInteractionAbort > xAbort; - uno::Reference< ucb::XInteractionSupplyAuthentication > - xSupplyAuthentication; - - for (sal_Int32 i = 0; i < rContinuations.getLength(); ++i) { - xRetry = uno::Reference< task::XInteractionRetry >( - rContinuations[i], uno::UNO_QUERY ); - if( xRetry.is() ) - continue; - - xAbort = uno::Reference< task::XInteractionAbort >( - rContinuations[i], uno::UNO_QUERY ); - if (xAbort.is()) - continue; - - xSupplyAuthentication - = uno::Reference< ucb::XInteractionSupplyAuthentication >( - rContinuations[i], uno::UNO_QUERY ); - if( xSupplyAuthentication.is() ) - continue; - } - - bool bRemember; - bool bRememberPersistent; - if (xSupplyAuthentication.is()) - { - ucb::RememberAuthentication eDefault; - uno::Sequence< ucb::RememberAuthentication > aModes( - xSupplyAuthentication->getRememberPasswordModes(eDefault)); - bRemember = eDefault != ucb::RememberAuthentication_NO; - bRememberPersistent = false; - for (sal_Int32 i = 0; i < aModes.getLength(); ++i) - if (aModes[i] == ucb::RememberAuthentication_PERSISTENT) - { - bRememberPersistent = true; - break; - } - } - else - { - bRemember = false; - bRememberPersistent = false; - } - - uno::Reference< task::XPasswordContainer > xContainer; - try - { - xContainer - = uno::Reference< task::XPasswordContainer >( - m_xSMgr->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.PasswordContainer"))), - uno::UNO_QUERY); - } - catch (uno::Exception const &) - { - } - - // xContainer works with userName passwdSequences pairs: - if (xContainer.is() && rRequest.HasUserName && rRequest.HasPassword ) - { - try - { - if (rRequest.UserName.getLength() == 0) - { - task::UrlRecord - aRec(xContainer->find(rRequest.ServerName, this)); - if (aRec.UserList.getLength() != 0) - { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName(aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - xSupplyAuthentication-> - setPassword(aRec.UserList[0].Passwords[0].getStr()); - } - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } - xSupplyAuthentication->select(); - return; - } - } - else - { - task::UrlRecord - aRec(xContainer->findForName(rRequest.ServerName, - rRequest.UserName, - this)); - if (aRec.UserList.getLength() != 0) - { - OSL_ENSURE(aRec.UserList[0].Passwords.getLength() != 0, - "empty password list"); - if (!rRequest.HasPassword - || rRequest.Password != aRec.UserList[0].Passwords[0]) - { - if (xSupplyAuthentication->canSetUserName()) - xSupplyAuthentication-> - setUserName(aRec.UserList[0].UserName.getStr()); - if (xSupplyAuthentication->canSetPassword()) - xSupplyAuthentication-> - setPassword(aRec.UserList[0].Passwords[0]. - getStr()); - if (aRec.UserList[0].Passwords.getLength() > 1) - { - if (rRequest.HasRealm) - { - if (xSupplyAuthentication->canSetRealm()) - xSupplyAuthentication-> - setRealm(aRec.UserList[0].Passwords[1]. - getStr()); - } - else if (xSupplyAuthentication->canSetAccount()) - xSupplyAuthentication-> - setAccount(aRec.UserList[0].Passwords[1]. - getStr()); - } - xSupplyAuthentication->select(); - return; - } - } - } - } - catch (task::NoMasterException const &) - {} // user did not enter master password - } - return; -} - -//========================================================================= -//========================================================================= -// // Content Implementation. // //========================================================================= @@ -446,9 +200,28 @@ uno::Any SAL_CALL Content::queryInterface( const uno::Type & rType ) { try { - return isFolder( new CommandEnvironment_Impl(m_xSMgr) ) - ? aRet - : uno::Any(); + uno::Reference< beans::XPropertySet > const xProps( + m_xSMgr, uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xCtx; + xCtx.set( xProps->getPropertyValue( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ), + uno::UNO_QUERY_THROW ); + + uno::Reference< task::XInteractionHandler > xIH( + task::PasswordContainerInteractionHandler::create( xCtx ) ); + + // Supply a command env to isFolder() that contains an interaction + // handler that uses the password container service to obtain + // credentials without displaying a password gui. + + uno::Reference< ucb::XCommandEnvironment > xCmdEnv( + ucb::CommandEnvironment::create( + xCtx, + xIH, + uno::Reference< ucb::XProgressHandler >() ) ); + + return isFolder( xCmdEnv ) ? aRet : uno::Any(); } catch ( uno::RuntimeException const & ) { @@ -630,17 +403,22 @@ uno::Any SAL_CALL Content::execute( ucb::CommandAbortedException, uno::RuntimeException ) { + OSL_TRACE( ">>>>> Content::execute: start: command: %s, env: %s", + rtl::OUStringToOString( aCommand.Name, + RTL_TEXTENCODING_UTF8 ).getStr(), + Environment.is() ? "present" : "missing" ); + uno::Any aRet; if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getPropertyValues" ) ) ) { - ////////////////////////////////////////////////////////////////// - // getPropertyValues - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// + // getPropertyValues + ////////////////////////////////////////////////////////////////// uno::Sequence< beans::Property > Properties; - if ( !( aCommand.Argument >>= Properties ) ) + if ( !( aCommand.Argument >>= Properties ) ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( @@ -652,17 +430,17 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - aRet <<= getPropertyValues( Properties, Environment ); + aRet <<= getPropertyValues( Properties, Environment ); } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "setPropertyValues" ) ) ) { - ////////////////////////////////////////////////////////////////// - // setPropertyValues - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// + // setPropertyValues + ////////////////////////////////////////////////////////////////// uno::Sequence< beans::PropertyValue > aProperties; - if ( !( aCommand.Argument >>= aProperties ) ) + if ( !( aCommand.Argument >>= aProperties ) ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( @@ -674,7 +452,7 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - if ( !aProperties.getLength() ) + if ( !aProperties.getLength() ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( @@ -713,8 +491,8 @@ uno::Any SAL_CALL Content::execute( RTL_CONSTASCII_STRINGPARAM( "open" ) ) ) { ////////////////////////////////////////////////////////////////// - // open - ////////////////////////////////////////////////////////////////// + // open + ////////////////////////////////////////////////////////////////// ucb::OpenCommandArgument2 aOpenCommand; if ( !( aCommand.Argument >>= aOpenCommand ) ) @@ -735,11 +513,11 @@ uno::Any SAL_CALL Content::execute( RTL_CONSTASCII_STRINGPARAM( "insert" ) ) ) { ////////////////////////////////////////////////////////////////// - // insert - ////////////////////////////////////////////////////////////////// + // insert + ////////////////////////////////////////////////////////////////// ucb::InsertCommandArgument arg; - if ( !( aCommand.Argument >>= arg ) ) + if ( !( aCommand.Argument >>= arg ) ) { ucbhelper::cancelCommandExecution( uno::makeAny( lang::IllegalArgumentException( @@ -751,23 +529,23 @@ uno::Any SAL_CALL Content::execute( // Unreachable } - insert( arg.Data, arg.ReplaceExisting, Environment ); + insert( arg.Data, arg.ReplaceExisting, Environment ); } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "delete" ) ) ) { - ////////////////////////////////////////////////////////////////// - // delete - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// + // delete + ////////////////////////////////////////////////////////////////// - sal_Bool bDeletePhysical = sal_False; - aCommand.Argument >>= bDeletePhysical; + sal_Bool bDeletePhysical = sal_False; + aCommand.Argument >>= bDeletePhysical; // KSO: Ignore parameter and destroy the content, if you don't support // putting objects into trashcan. ( Since we do not have a trash can // service yet (src603), you actually have no other choice. ) // if ( bDeletePhysical ) -// { +// { try { std::auto_ptr< DAVResourceAccess > xResAccess; @@ -823,7 +601,7 @@ uno::Any SAL_CALL Content::execute( { ////////////////////////////////////////////////////////////////// // post - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// ucb::PostCommandArgument2 aArg; if ( !( aCommand.Argument >>= aArg ) ) @@ -840,20 +618,67 @@ uno::Any SAL_CALL Content::execute( post( aArg, Environment ); } + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "lock" ) ) && + supportsExclusiveWriteLock( Environment ) ) + { + ////////////////////////////////////////////////////////////////// + // lock + ////////////////////////////////////////////////////////////////// + + lock( Environment ); + } + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "unlock" ) ) && + supportsExclusiveWriteLock( Environment ) ) + { + ////////////////////////////////////////////////////////////////// + // unlock + ////////////////////////////////////////////////////////////////// + + unlock( Environment ); + } + else if ( aCommand.Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "createNewContent" ) ) && + isFolder( Environment ) ) + { + ////////////////////////////////////////////////////////////////// + // createNewContent + ////////////////////////////////////////////////////////////////// + + ucb::ContentInfo aArg; + if ( !( aCommand.Argument >>= aArg ) ) + { + ucbhelper::cancelCommandExecution( + uno::makeAny( lang::IllegalArgumentException( + rtl::OUString::createFromAscii( + "Wrong argument type!" ), + static_cast< cppu::OWeakObject * >( this ), + -1 ) ), + Environment ); + // Unreachable + } + + aRet = uno::makeAny( createNewContent( aArg ) ); + } else { - ////////////////////////////////////////////////////////////////// - // Unsupported command - ////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////// + // Unsupported command + ////////////////////////////////////////////////////////////////// ucbhelper::cancelCommandExecution( uno::makeAny( ucb::UnsupportedCommandException( - rtl::OUString(), - static_cast< cppu::OWeakObject * >( this ) ) ), + aCommand.Name, + static_cast< cppu::OWeakObject * >( this ) ) ), Environment ); // Unreachable } + OSL_TRACE( "<<<<< Content::execute: end: command: %s", + rtl::OUStringToOString( aCommand.Name, + RTL_TEXTENCODING_UTF8 ).getStr() ); + return aRet; } @@ -863,19 +688,22 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) throw( uno::RuntimeException ) { try + { + std::auto_ptr< DAVResourceAccess > xResAccess; { - std::auto_ptr< DAVResourceAccess > xResAccess; - { - osl::MutexGuard aGuard( m_aMutex ); - xResAccess.reset( - new DAVResourceAccess( *m_xResAccess.get() ) ); - } - xResAccess->ABORT(); + osl::MutexGuard aGuard( m_aMutex ); + xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); } - catch ( DAVException const & /*e*/ ) + xResAccess->abort(); { - // ABORT command failed! + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); } + } + catch ( DAVException const & ) + { + // abort failed! + } } //========================================================================= @@ -893,8 +721,8 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name, lang::IllegalArgumentException, uno::RuntimeException ) { -// if ( m_bTransient ) -// @@@ ??? +// if ( m_bTransient ) +// @@@ ??? if ( !Name.getLength() ) throw lang::IllegalArgumentException(); @@ -902,8 +730,8 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name, // Check property type. if ( !UCBDeadPropertyValue::supportsType( DefaultValue.getValueType() ) ) { - OSL_ENSURE( sal_False, "Content::addProperty - " - "Unsupported property type!" ); + OSL_ENSURE( sal_False, + "Content::addProperty - Unsupported property type!" ); throw beans::IllegalTypeException(); } @@ -950,10 +778,10 @@ void SAL_CALL Content::addProperty( const rtl::OUString& Name, // Notify propertyset info change listeners. beans::PropertySetInfoChangeEvent evt( - static_cast< cppu::OWeakObject * >( this ), - Name, - -1, // No handle available - beans::PropertySetInfoChange::PROPERTY_INSERTED ); + static_cast< cppu::OWeakObject * >( this ), + Name, + -1, // No handle available + beans::PropertySetInfoChange::PROPERTY_INSERTED ); notifyPropertySetInfoChange( evt ); } catch ( DAVException const & e ) @@ -1029,7 +857,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name ) { beans::Property aProp = getPropertySetInfo( xEnv, sal_False /* don't cache data */ ) - ->getPropertyByName( Name ); + ->getPropertyByName( Name ); if ( !( aProp.Attributes & beans::PropertyAttribute::REMOVEABLE ) ) { @@ -1039,7 +867,7 @@ void SAL_CALL Content::removeProperty( const rtl::OUString& Name ) } catch ( beans::UnknownPropertyException const & ) { -// OSL_ENSURE( sal_False, "removeProperty - Unknown property!" ); + //OSL_ENSURE( sal_False, "removeProperty - Unknown property!" ); throw; } #endif @@ -1270,7 +1098,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >& rProvider, const rtl::OUString& rContentId ) { - // Note: Empty sequence means "get values of all supported properties". + // Note: Empty sequence means "get values of all supported properties". rtl::Reference< ::ucbhelper::PropertyValueSet > xRow = new ::ucbhelper::PropertyValueSet( rSMgr ); @@ -1279,10 +1107,10 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( nCount ) { uno::Reference< beans::XPropertySet > xAdditionalPropSet; - sal_Bool bTriedToGetAdditonalPropSet = sal_False; + sal_Bool bTriedToGetAdditonalPropSet = sal_False; const beans::Property* pProps = rProperties.getConstArray(); - for ( sal_Int32 n = 0; n < nCount; ++n ) + for ( sal_Int32 n = 0; n < nCount; ++n ) { const beans::Property& rProp = pProps[ n ]; @@ -1338,9 +1166,9 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // Append all local Additional Properties. uno::Reference< beans::XPropertySet > xSet( - rProvider->getAdditionalPropertySet( rContentId, sal_False ), - uno::UNO_QUERY ); - xRow->appendPropertySet( xSet ); + rProvider->getAdditionalPropertySet( rContentId, sal_False ), + uno::UNO_QUERY ); + xRow->appendPropertySet( xSet ); } return uno::Reference< sdbc::XRow >( xRow.get() ); @@ -1357,8 +1185,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( std::auto_ptr< DAVResourceAccess > xResAccess; rtl::OUString aEscapedTitle; bool bHasAll = false; - uno::Reference< lang::XMultiServiceFactory > xSMgr; - uno::Reference< ucb::XContentIdentifier > xIdentifier; + uno::Reference< lang::XMultiServiceFactory > xSMgr; + uno::Reference< ucb::XContentIdentifier > xIdentifier; rtl::Reference< ::ucbhelper::ContentProviderImplHelper > xProvider; { @@ -1400,15 +1228,19 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( DAV == rType ) { - // cache lookup... getResourceType may fill the props cache via PROPFIND! + // cache lookup... getResourceType may fill the props cache via + // PROPFIND! if ( m_xCachedProps.get() ) { - xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) ); + xCachedProps.reset( + new ContentProperties( *m_xCachedProps.get() ) ); std::vector< rtl::OUString > aMissingProps; - if ( xCachedProps->containsAllNames( rProperties, aMissingProps ) ) + if ( xCachedProps->containsAllNames( + rProperties, aMissingProps ) ) { - // All properties are already in cache! No server access needed. + // All properties are already in cache! No server access + // needed. bHasAll = true; } @@ -1421,7 +1253,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // Only DAV resources support PROPFIND std::vector< rtl::OUString > aPropNames; - uno::Sequence< beans::Property > aProperties( rProperties.getLength() ); + uno::Sequence< beans::Property > aProperties( + rProperties.getLength() ); if ( m_aFailedPropNames.size() > 0 ) { @@ -1474,7 +1307,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { if ( xProps.get()) xProps->addProperties( - aPropNames, ContentProperties( resources[ 0 ] )); + aPropNames, + ContentProperties( resources[ 0 ] )); else xProps.reset( new ContentProperties( resources[ 0 ] ) ); @@ -1483,7 +1317,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( catch ( DAVException const & e ) { bNetworkAccessAllowed - = shouldAccessNetworkAfterException( e ); + = shouldAccessNetworkAfterException( e ); if ( !bNetworkAccessAllowed ) { @@ -1523,16 +1357,16 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( xProps.get() ) xProps->addProperties( - aMissingProps, - ContentProperties( resource ) ); + aMissingProps, + ContentProperties( resource ) ); else xProps.reset ( new ContentProperties( resource ) ); if ( m_eResourceType == NON_DAV ) xProps->addProperties( aMissingProps, ContentProperties( - aEscapedTitle, - false ) ); + aEscapedTitle, + false ) ); } catch ( DAVException const & e ) { @@ -1548,15 +1382,15 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( } } } + // might trigger HTTP redirect. - // Therefore, title must be upadated here. + // Therefore, title must be updated here. NeonUri aUri( xResAccess->getURL() ); aEscapedTitle = aUri.GetPathBaseName(); if ( UNKNOWN == rType ) { - xProps.reset( - new ContentProperties( aEscapedTitle ) ); + xProps.reset( new ContentProperties( aEscapedTitle ) ); } // For DAV resources we only know the Title, for non-DAV @@ -1565,31 +1399,29 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { //xProps.reset( // new ContentProperties( aEscapedTitle ) ); - xProps->addProperty( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Title" )), - uno::makeAny( aEscapedTitle), true); + xProps->addProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), + uno::makeAny( aEscapedTitle ), + true ); } else { if ( !xProps.get() ) - xProps.reset( - new ContentProperties( aEscapedTitle, false ) ); + xProps.reset( new ContentProperties( aEscapedTitle, false ) ); else - xProps->addProperty( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "Title" )), - uno::makeAny( aEscapedTitle), true); - - xProps->addProperty( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "IsFolder" )), - uno::makeAny( false), true); - xProps->addProperty( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "IsDocument" )), - uno::makeAny( true), true); + xProps->addProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), + uno::makeAny( aEscapedTitle ), + true ); + xProps->addProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ), + uno::makeAny( false ), + true ); + xProps->addProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDocument" ) ), + uno::makeAny( true ), + true ); } } else @@ -1601,16 +1433,35 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( m_bCollection ) ); } - // Add BaseURI property, if requested. - if ( !xProps->contains( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ) ) ) + sal_Int32 nCount = rProperties.getLength(); + for ( sal_Int32 n = 0; n < nCount; ++n ) { - xProps->addProperty( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "BaseURI" ) ), - uno::makeAny( - getBaseURI( xResAccess ) ), - true ); + const rtl::OUString rName = rProperties[ n ].Name; + if ( rName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "BaseURI" ) ) ) + { + // Add BaseURI property, if requested. + xProps->addProperty( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BaseURI" ) ), + uno::makeAny( getBaseURI( xResAccess ) ), + true ); + } + else if ( rName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + // Add CreatableContentsInfo property, if requested. + sal_Bool bFolder = sal_False; + xProps->getValue( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" ) ) ) + >>= bFolder; + xProps->addProperty( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( "CreatableContentsInfo" ) ), + uno::makeAny( bFolder + ? queryCreatableContentsInfo() + : uno::Sequence< ucb::ContentInfo >() ), + true ); + } } uno::Reference< sdbc::XRow > xResultRow @@ -1663,7 +1514,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( beans::PropertyChangeEvent aEvent; aEvent.Source = static_cast< cppu::OWeakObject * >( this ); - aEvent.Further = sal_False; + aEvent.Further = sal_False; // aEvent.PropertyName = aEvent.PropertyHandle = -1; // aEvent.OldValue = @@ -1724,7 +1575,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( static_cast< cppu::OWeakObject * >( this ) ); } else if ( rName.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ) + RTL_CONSTASCII_STRINGPARAM( "IsFolder" ) ) ) { // Read-only property! aRet[ n ] <<= lang::IllegalAccessException( @@ -1843,6 +1694,15 @@ uno::Sequence< uno::Any > Content::setPropertyValues( "Property is read-only!" ), static_cast< cppu::OWeakObject * >( this ) ); } + if ( rName.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( "CreatableContentsInfo" ) ) ) + { + // Read-only property! + aRet[ n ] <<= lang::IllegalAccessException( + rtl::OUString::createFromAscii( + "Property is read-only!" ), + static_cast< cppu::OWeakObject * >( this ) ); + } else { if ( getResourceType( xEnv, xResAccess ) == DAV ) @@ -2035,7 +1895,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( aEvent.OldValue = uno::makeAny( aOldTitle ); aEvent.NewValue = uno::makeAny( aNewTitle ); - m_aEscapedTitle = NeonUri::escapeSegment( aNewTitle ); + m_aEscapedTitle = NeonUri::escapeSegment( aNewTitle ); aChanges.getArray()[ nChanged ] = aEvent; nChanged++; @@ -2043,8 +1903,8 @@ uno::Sequence< uno::Any > Content::setPropertyValues( if ( nChanged > 0 ) { - aChanges.realloc( nChanged ); - notifyPropertiesChange( aChanges ); + aChanges.realloc( nChanged ); + notifyPropertiesChange( aChanges ); } { @@ -2150,7 +2010,8 @@ uno::Any Content::open( // cache headers. if ( !m_xCachedProps.get()) - m_xCachedProps.reset( new ContentProperties( aResource ) ); + m_xCachedProps.reset( + new ContentProperties( aResource ) ); else m_xCachedProps->addProperties( aResource ); @@ -2195,9 +2056,11 @@ uno::Any Content::open( // cache headers. if ( !m_xCachedProps.get()) - m_xCachedProps.reset( new ContentProperties( aResource ) ); + m_xCachedProps.reset( + new ContentProperties( aResource ) ); else - m_xCachedProps->addProperties( aResource.properties ); + m_xCachedProps->addProperties( + aResource.properties ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); @@ -2407,17 +2270,17 @@ void Content::insert( { /* [RFC 2616] - HTTP - The PUT method requests that the enclosed entity be stored under the - supplied Request-URI. If the Request-URI refers to an already - existing resource, the enclosed entity SHOULD be considered as a - modified version of the one residing on the origin server. + The PUT method requests that the enclosed entity be stored under the + supplied Request-URI. If the Request-URI refers to an already + existing resource, the enclosed entity SHOULD be considered as a + modified version of the one residing on the origin server. */ /* [RFC 2518] - WebDAV - MKCOL creates a new collection resource at the location specified by - the Request-URI. If the resource identified by the Request-URI is - non-null then the MKCOL MUST fail. + MKCOL creates a new collection resource at the location specified by + the Request-URI. If the resource identified by the Request-URI is + non-null then the MKCOL MUST fail. */ // ==> Complain on PUT, continue on MKCOL. @@ -2887,6 +2750,99 @@ void Content::destroy( sal_Bool bDeletePhysical ) } //========================================================================= +bool Content::supportsExclusiveWriteLock( + const uno::Reference< ucb::XCommandEnvironment >& Environment ) +{ + if ( getResourceType( Environment ) == DAV ) + { + if ( m_xCachedProps.get() ) + { + uno::Sequence< ucb::LockEntry > aSupportedLocks; + if ( m_xCachedProps->getValue( DAVProperties::SUPPORTEDLOCK ) + >>= aSupportedLocks ) + { + for ( sal_Int32 n = 0; n < aSupportedLocks.getLength(); ++n ) + { + if ( aSupportedLocks[ n ].Scope + == ucb::LockScope_EXCLUSIVE && + aSupportedLocks[ n ].Type + == ucb::LockType_WRITE ) + return true; + } + } + } + } + return false; +} + +//========================================================================= +void Content::lock( + const uno::Reference< ucb::XCommandEnvironment >& Environment ) + throw( uno::Exception ) +{ + try + { + std::auto_ptr< DAVResourceAccess > xResAccess; + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); + } + + uno::Any aOwnerAny; + aOwnerAny + <<= rtl::OUString::createFromAscii( "http://ucb.openoffice.org" ); + + ucb::Lock aLock( + ucb::LockScope_EXCLUSIVE, + ucb::LockType_WRITE, + ucb::LockDepth_ZERO, + aOwnerAny, + 180, // lock timeout in secs + //-1, // infinite lock + uno::Sequence< ::rtl::OUString >() ); + + xResAccess->LOCK( aLock, Environment ); + + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); + } + } + catch ( DAVException const & e ) + { + cancelCommandExecution( e, Environment, sal_False ); + // Unreachable + } +} + +//========================================================================= +void Content::unlock( + const uno::Reference< ucb::XCommandEnvironment >& Environment ) + throw( uno::Exception ) +{ + try + { + std::auto_ptr< DAVResourceAccess > xResAccess; + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); + } + + xResAccess->UNLOCK( Environment ); + + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); + } + } + catch ( DAVException const & e ) + { + cancelCommandExecution( e, Environment, sal_False ); + // Unreachable + } +} + +//========================================================================= sal_Bool Content::exchangeIdentity( const uno::Reference< ucb::XContentIdentifier >& xNewId ) { @@ -2936,9 +2892,9 @@ sal_Bool Content::exchangeIdentity( 0, aOldURL.getLength(), xNewId->getContentIdentifier() ); - uno::Reference< ucb::XContentIdentifier > - xNewChildId - = new ::ucbhelper::ContentIdentifier( m_xSMgr, aNewChildURL ); + uno::Reference< ucb::XContentIdentifier > xNewChildId + = new ::ucbhelper::ContentIdentifier( + m_xSMgr, aNewChildURL ); if ( !xChild->exchangeIdentity( xNewChildId ) ) return sal_False; @@ -3010,7 +2966,6 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) aArgs ); return aException; } - default: break; } @@ -3022,14 +2977,14 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) if ( bWrite ) aException <<= ucb::InteractiveNetworkWriteException( - rtl::OUString(), + e.getData(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, e.getData() ); else aException <<= ucb::InteractiveNetworkReadException( - rtl::OUString(), + e.getData(), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, e.getData() ); @@ -3046,12 +3001,12 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_HTTP_AUTH: -// break; +// case DAVException::DAV_HTTP_AUTH: +// break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_HTTP_AUTHPROXY: -// break; +// case DAVException::DAV_HTTP_AUTHPROXY: +// break; case DAVException::DAV_HTTP_CONNECT: aException <<= @@ -3063,16 +3018,16 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_HTTP_TIMEOUT: -// break; +// case DAVException::DAV_HTTP_TIMEOUT: +// break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_HTTP_REDIRECT: -// break; +// case DAVException::DAV_HTTP_REDIRECT: +// break; // @@@ No matching InteractiveNetwork*Exception -// case DAVException::DAV_SESSION_CREATE: -// break; +// case DAVException::DAV_SESSION_CREATE: +// break; case DAVException::DAV_INVALID_ARG: aException <<= @@ -3082,6 +3037,62 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) -1 ); break; + case DAVException::DAV_LOCKED: +#if 1 + aException <<= + ucb::InteractiveLockingLockedException( + rtl::OUString::createFromAscii( "Locked!" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + m_xIdentifier->getContentIdentifier(), + sal_True ); +#else + { + uno::Sequence< uno::Any > aArgs( 1 ); + aArgs[ 0 ] <<= beans::PropertyValue( + rtl::OUString::createFromAscii("Uri"), -1, + uno::makeAny(m_xIdentifier->getContentIdentifier()), + beans::PropertyState_DIRECT_VALUE); + + aException <<= + ucb::InteractiveAugmentedIOException( + rtl::OUString::createFromAscii( "Locked!" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + ucb::IOErrorCode_LOCKING_VIOLATION, + aArgs ); + } +#endif + break; + + case DAVException::DAV_LOCKED_SELF: + aException <<= + ucb::InteractiveLockingLockedException( + rtl::OUString::createFromAscii( "Locked (self)!" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + m_xIdentifier->getContentIdentifier(), + sal_True ); + break; + + case DAVException::DAV_NOT_LOCKED: + aException <<= + ucb::InteractiveLockingNotLockedException( + rtl::OUString::createFromAscii( "Not locked!" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + m_xIdentifier->getContentIdentifier() ); + break; + + case DAVException::DAV_LOCK_EXPIRED: + aException <<= + ucb::InteractiveLockingLockExpiredException( + rtl::OUString::createFromAscii( "Lock expired!" ), + static_cast< cppu::OWeakObject * >( this ), + task::InteractionClassification_ERROR, + m_xIdentifier->getContentIdentifier() ); + break; + default: aException <<= ucb::InteractiveNetworkGeneralException( @@ -3120,7 +3131,8 @@ void Content::cancelCommandExecution( } //========================================================================= -const rtl::OUString Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ) +const rtl::OUString +Content::getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ) { osl::Guard< osl::Mutex > aGuard( m_aMutex ); @@ -3181,11 +3193,17 @@ const Content::ResourceType & Content::getResourceType( // this is a DAV resource. std::vector< DAVResource > resources; std::vector< rtl::OUString > aPropNames; - uno::Sequence< beans::Property > aProperties( 4 ); - aProperties[ 0 ].Name = rtl::OUString::createFromAscii( "IsFolder" ); - aProperties[ 1 ].Name = rtl::OUString::createFromAscii( "IsDocument" ); - aProperties[ 2 ].Name = rtl::OUString::createFromAscii( "IsReadOnly" ); - aProperties[ 3 ].Name = rtl::OUString::createFromAscii( "MediaType" ); + uno::Sequence< beans::Property > aProperties( 5 ); + aProperties[ 0 ].Name + = rtl::OUString::createFromAscii( "IsFolder" ); + aProperties[ 1 ].Name + = rtl::OUString::createFromAscii( "IsDocument" ); + aProperties[ 2 ].Name + = rtl::OUString::createFromAscii( "IsReadOnly" ); + aProperties[ 3 ].Name + = rtl::OUString::createFromAscii( "MediaType" ); + aProperties[ 4 ].Name + = DAVProperties::SUPPORTEDLOCK; ContentProperties::UCBNamesToDAVNames( aProperties, aPropNames ); @@ -3195,16 +3213,19 @@ const Content::ResourceType & Content::getResourceType( if ( resources.size() == 1 ) { - m_xCachedProps.reset( new ContentProperties( resources[ 0 ] ) ); - m_xCachedProps->containsAllNames( aProperties, m_aFailedPropNames ); + m_xCachedProps.reset( + new ContentProperties( resources[ 0 ] ) ); + m_xCachedProps->containsAllNames( + aProperties, m_aFailedPropNames ); } + eResourceType = DAV; } - catch ( DAVException const& e) + catch ( DAVException const & e ) { rResAccess->resetUri(); - if (e.getStatus() == SC_METHOD_NOT_ALLOWED) + if ( e.getStatus() == SC_METHOD_NOT_ALLOWED ) { // Status SC_METHOD_NOT_ALLOWED is a safe indicator that the // resource is NON_DAV @@ -3213,7 +3234,6 @@ const Content::ResourceType & Content::getResourceType( } } m_eResourceType = eResourceType; - } return m_eResourceType; } diff --git a/ucb/source/ucp/webdav/webdavcontent.hxx b/ucb/source/ucp/webdav/webdavcontent.hxx index 861e48bdfcee..0568b2bfbb54 100644 --- a/ucb/source/ucp/webdav/webdavcontent.hxx +++ b/ucb/source/ucp/webdav/webdavcontent.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavcontent.hxx,v $ - * $Revision: 1.23.32.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -88,7 +85,7 @@ class Content : public ::ucbhelper::ContentImplHelper, rtl::OUString m_aEscapedTitle; ResourceType m_eResourceType; ContentProvider* m_pProvider; // No need for a ref, base class holds object - bool m_bTransient; + bool m_bTransient; bool m_bCollection; bool m_bDidGetOrHead; std::vector< rtl::OUString > m_aFailedPropNames; @@ -96,81 +93,91 @@ class Content : public ::ucbhelper::ContentImplHelper, private: virtual com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ); + com::sun::star::ucb::XCommandEnvironment > & xEnv ); virtual com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo > getCommands( const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ); - virtual ::rtl::OUString getParentURL(); + com::sun::star::ucb::XCommandEnvironment > & xEnv ); + virtual ::rtl::OUString getParentURL(); - sal_Bool isFolder( const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) + sal_Bool isFolder( const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( ::com::sun::star::uno::Exception ); - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > - getPropertyValues( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > + getPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProperties, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) + const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( ::com::sun::star::uno::Exception ); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > - setPropertyValues( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& rValues, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) + setPropertyValues( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& rValues, + const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( ::com::sun::star::uno::Exception ); typedef rtl::Reference< Content > ContentRef; - typedef std::list< ContentRef > ContentRefList; - void queryChildren( ContentRefList& rChildren); + typedef std::list< ContentRef > ContentRefList; + void queryChildren( ContentRefList& rChildren); - sal_Bool exchangeIdentity( - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XContentIdentifier >& xNewId ); + sal_Bool + exchangeIdentity( const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XContentIdentifier >& xNewId ); - const rtl::OUString getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ); + const rtl::OUString + getBaseURI( const std::auto_ptr< DAVResourceAccess > & rResAccess ); - const ResourceType & getResourceType( - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) + const ResourceType & + getResourceType( const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv ) throw ( ::com::sun::star::uno::Exception ); - const ResourceType & getResourceType( - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XCommandEnvironment >& xEnv, - const std::auto_ptr< DAVResourceAccess > & rResAccess ) + const ResourceType & + getResourceType( const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XCommandEnvironment >& xEnv, + const std::auto_ptr< DAVResourceAccess > & rResAccess ) throw ( ::com::sun::star::uno::Exception ); // Command "open" com::sun::star::uno::Any open( const com::sun::star::ucb::OpenCommandArgument2 & rArg, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) + com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw( ::com::sun::star::uno::Exception ); // Command "post" void post( const com::sun::star::ucb::PostCommandArgument2 & rArg, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment > & xEnv ) + com::sun::star::ucb::XCommandEnvironment > & xEnv ) throw( ::com::sun::star::uno::Exception ); - // Command "insert" - void insert( const ::com::sun::star::uno::Reference< - ::com::sun::star::io::XInputStream > & xInputStream, - sal_Bool bReplaceExisting, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + // Command "insert" + void insert( const ::com::sun::star::uno::Reference< + ::com::sun::star::io::XInputStream > & xInputStream, + sal_Bool bReplaceExisting, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception ); // Command "transfer" void transfer( const ::com::sun::star::ucb::TransferInfo & rArgs, const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception ); // Command "delete" - void destroy( sal_Bool bDeletePhysical ) + void destroy( sal_Bool bDeletePhysical ) + throw( ::com::sun::star::uno::Exception ); + + // Command "lock" + void lock( const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& Environment ) + throw( ::com::sun::star::uno::Exception ); + + // Command "unlock" + void unlock( const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( ::com::sun::star::uno::Exception ); ::com::sun::star::uno::Any MapDAVException( const DAVException & e, @@ -184,57 +191,62 @@ private: static bool shouldAccessNetworkAfterException( const DAVException & e ); + bool supportsExclusiveWriteLock( + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& Environment ); + public: - Content( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ContentProvider* pProvider, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XContentIdentifier >& Identifier, + Content( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ContentProvider* pProvider, + const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XContentIdentifier >& Identifier, rtl::Reference< DAVSessionFactory > const & rSessionFactory ) throw ( ::com::sun::star::ucb::ContentCreationException ); - Content( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, - ContentProvider* pProvider, - const ::com::sun::star::uno::Reference< - ::com::sun::star::ucb::XContentIdentifier >& Identifier, + Content( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + ContentProvider* pProvider, + const ::com::sun::star::uno::Reference< + ::com::sun::star::ucb::XContentIdentifier >& Identifier, rtl::Reference< DAVSessionFactory > const & rSessionFactory, - sal_Bool isCollection ) + sal_Bool isCollection ) throw ( ::com::sun::star::ucb::ContentCreationException ); - virtual ~Content(); + virtual ~Content(); - // XInterface - XINTERFACE_DECL() + // XInterface + XINTERFACE_DECL() // XTypeProvider XTYPEPROVIDER_DECL() // XServiceInfo virtual ::rtl::OUString SAL_CALL - getImplementationName() + getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - getSupportedServiceNames() + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - // XContent - virtual rtl::OUString SAL_CALL - getContentType() + // XContent + virtual rtl::OUString SAL_CALL + getContentType() throw( com::sun::star::uno::RuntimeException ); - // XCommandProcessor - virtual com::sun::star::uno::Any SAL_CALL - execute( const com::sun::star::ucb::Command& aCommand, - sal_Int32 CommandId, - const com::sun::star::uno::Reference< - com::sun::star::ucb::XCommandEnvironment >& Environment ) + // XCommandProcessor + virtual com::sun::star::uno::Any SAL_CALL + execute( const com::sun::star::ucb::Command& aCommand, + sal_Int32 CommandId, + const com::sun::star::uno::Reference< + com::sun::star::ucb::XCommandEnvironment >& Environment ) throw( com::sun::star::uno::Exception, - com::sun::star::ucb::CommandAbortedException, - com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL - abort( sal_Int32 CommandId ) + com::sun::star::ucb::CommandAbortedException, + com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL + abort( sal_Int32 CommandId ) throw( com::sun::star::uno::RuntimeException ); - // XPropertyContainer + // XPropertyContainer virtual void SAL_CALL addProperty( const rtl::OUString& Name, sal_Int16 Attributes, @@ -250,36 +262,36 @@ public: com::sun::star::beans::NotRemoveableException, com::sun::star::uno::RuntimeException ); - ////////////////////////////////////////////////////////////////////// - // Additional interfaces - ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // Additional interfaces + ////////////////////////////////////////////////////////////////////// - // XContentCreator + // XContentCreator virtual com::sun::star::uno::Sequence< com::sun::star::ucb::ContentInfo > SAL_CALL - queryCreatableContentsInfo() + queryCreatableContentsInfo() throw( com::sun::star::uno::RuntimeException ); - virtual com::sun::star::uno::Reference< - com::sun::star::ucb::XContent > SAL_CALL - createNewContent( const com::sun::star::ucb::ContentInfo& Info ) + virtual com::sun::star::uno::Reference< + com::sun::star::ucb::XContent > SAL_CALL + createNewContent( const com::sun::star::ucb::ContentInfo& Info ) throw( com::sun::star::uno::RuntimeException ); - ////////////////////////////////////////////////////////////////////// - // Non-interface methods. - ////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////// + // Non-interface methods. + ////////////////////////////////////////////////////////////////////// DAVResourceAccess & getResourceAccess() { return *m_xResAccess; } - // Called from resultset data supplier. - static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > - getPropertyValues( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, + // Called from resultset data supplier. + static ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > + getPropertyValues( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& rSMgr, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::Property >& rProperties, - const ContentProperties& rData, + ::com::sun::star::beans::Property >& rProperties, + const ContentProperties& rData, const rtl::Reference< ::ucbhelper::ContentProviderImplHelper >& rProvider, - const ::rtl::OUString& rContentId ); + const ::rtl::OUString& rContentId ); }; } diff --git a/ucb/source/ucp/webdav/webdavcontentcaps.cxx b/ucb/source/ucp/webdav/webdavcontentcaps.cxx index 305d509b4e2c..145c256010f9 100644 --- a/ucb/source/ucp/webdav/webdavcontentcaps.cxx +++ b/ucb/source/ucp/webdav/webdavcontentcaps.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavcontentcaps.cxx,v $ - * $Revision: 1.21.20.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_ucb.hxx" /************************************************************************** - TODO + TODO ************************************************************************** *************************************************************************/ @@ -41,24 +38,19 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ucb/CommandInfo.hpp> +#include <com/sun/star/ucb/ContentInfo.hpp> #include <com/sun/star/ucb/OpenCommandArgument2.hpp> #include <com/sun/star/ucb/InsertCommandArgument.hpp> #include <com/sun/star/ucb/PostCommandArgument2.hpp> #include <com/sun/star/ucb/TransferInfo.hpp> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_UTIL_DATETIME_HXX_ #include <com/sun/star/util/DateTime.hpp> -#endif #include <com/sun/star/ucb/Link.hpp> #include <com/sun/star/ucb/Lock.hpp> #include <com/sun/star/ucb/LockEntry.hpp> #include "webdavcontent.hxx" -#ifndef _WEBDAV_UCP_PROVIDFER_HXX #include "webdavprovider.hxx" -#endif -#ifndef _WEBDAV_SESSION_HXX #include "DAVSession.hxx" -#endif #include "ContentProperties.hxx" using namespace com::sun::star; @@ -162,6 +154,16 @@ bool ContentProvider::getProperty( beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) ); + m_pProps->insert( + beans::Property( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ), + -1, + getCppuType( static_cast< + const uno::Sequence< ucb::ContentInfo > * >( 0 ) ), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::READONLY ) ); + // Standard DAV properties. m_pProps->insert( @@ -221,17 +223,16 @@ bool ContentProvider::getProperty( m_pProps->insert( beans::Property( - DAVProperties::LOCKDISCOVERY, + DAVProperties::LOCKDISCOVERY, -1, getCppuType( static_cast< - const uno::Sequence< - com::sun::star::ucb::Lock > * >( 0 ) ), + const uno::Sequence< ucb::Lock > * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) ); m_pProps->insert( beans::Property( - DAVProperties::RESOURCETYPE, + DAVProperties::RESOURCETYPE, -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND @@ -239,27 +240,25 @@ bool ContentProvider::getProperty( m_pProps->insert( beans::Property( - DAVProperties::SOURCE, + DAVProperties::SOURCE, -1, getCppuType( static_cast< - const uno::Sequence< - com::sun::star::ucb::Link > * >( 0 ) ), + const uno::Sequence< ucb::Link > * >( 0 ) ), beans::PropertyAttribute::BOUND ) ); m_pProps->insert( beans::Property( - DAVProperties::SUPPORTEDLOCK, + DAVProperties::SUPPORTEDLOCK, -1, getCppuType( static_cast< const uno::Sequence< - com::sun::star::ucb::LockEntry > * >( - 0 ) ), + ucb::LockEntry > * >( 0 ) ), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ) ); m_pProps->insert( beans::Property( - DAVProperties::EXECUTABLE, + DAVProperties::EXECUTABLE, -1, getCppuType( static_cast< const rtl::OUString * >( 0 ) ), beans::PropertyAttribute::BOUND ) ); @@ -301,7 +300,7 @@ bool ContentProvider::getProperty( // virtual uno::Sequence< beans::Property > Content::getProperties( - const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv ) + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) { sal_Bool bTransient; std::auto_ptr< DAVResourceAccess > xResAccess; @@ -314,7 +313,8 @@ uno::Sequence< beans::Property > Content::getProperties( bTransient = m_bTransient; xResAccess.reset( new DAVResourceAccess( *m_xResAccess.get() ) ); if ( m_xCachedProps.get() ) - xCachedProps.reset( new ContentProperties( *m_xCachedProps.get() ) ); + xCachedProps.reset( + new ContentProperties( *m_xCachedProps.get() ) ); xProvider.set( m_pProvider ); } @@ -356,6 +356,7 @@ uno::Sequence< beans::Property > Content::getProperties( sal_Bool bHasDateModified = sal_False; sal_Bool bHasMediaType = sal_False; sal_Bool bHasSize = sal_False; + sal_Bool bHasCreatableInfos = sal_False; { std::set< rtl::OUString >::const_iterator it = aPropSet.begin(); @@ -436,7 +437,13 @@ uno::Sequence< beans::Property > Content::getProperties( { bHasSize = sal_True; } - + else if ( !bHasCreatableInfos && + (*it).equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( + "CreatableContentsInfo" ) ) ) + { + bHasCreatableInfos = sal_True; + } it++; } } @@ -486,6 +493,11 @@ uno::Sequence< beans::Property > Content::getProperties( aPropSet.insert( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ) ); + if ( !bHasCreatableInfos ) + aPropSet.insert( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "CreatableContentsInfo" ) ) ); + // Add cached properties, if present and still missing. if ( xCachedProps.get() ) { @@ -525,236 +537,136 @@ uno::Sequence< beans::Property > Content::getProperties( //========================================================================= // virtual -uno::Sequence< com::sun::star::ucb::CommandInfo > Content::getCommands( - const uno::Reference< com::sun::star::ucb::XCommandEnvironment > & xEnv ) +uno::Sequence< ucb::CommandInfo > Content::getCommands( + const uno::Reference< ucb::XCommandEnvironment > & xEnv ) { osl::Guard< osl::Mutex > aGuard( m_aMutex ); - sal_Bool bFolder = sal_False; - - try - { - bFolder = isFolder( xEnv ); - } - catch ( uno::Exception const & ) - { - static com::sun::star::ucb::CommandInfo aDefaultCommandInfoTable[] = - { - /////////////////////////////////////////////////////////////// - // Just mandatory commands avail. - /////////////////////////////////////////////////////////////// - - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), - -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), - -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), - -1, - getCppuType( static_cast< - uno::Sequence< beans::Property > * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), - -1, - getCppuType( static_cast< - uno::Sequence< beans::PropertyValue > * >( 0 ) ) - ) - }; - return uno::Sequence< com::sun::star::ucb::CommandInfo >( - aDefaultCommandInfoTable, 4 ); - } - - if ( bFolder ) - { - //================================================================= - // - // Folder: Supported commands - // - //================================================================= + uno::Sequence< ucb::CommandInfo > aCmdInfo( 8 ); - static com::sun::star::ucb::CommandInfo aFolderCommandInfoTable[] = - { - /////////////////////////////////////////////////////////////// - // Required commands - /////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// + // Mandatory commands + /////////////////////////////////////////////////////////////// - com::sun::star::ucb::CommandInfo( + aCmdInfo[ 0 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( + getCppuVoidType() ); + aCmdInfo[ 1 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( + getCppuVoidType() ); + aCmdInfo[ 2 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), -1, getCppuType( static_cast< - uno::Sequence< beans::Property > * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( + uno::Sequence< beans::Property > * >( 0 ) ) ); + aCmdInfo[ 3 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), -1, getCppuType( static_cast< - uno::Sequence< beans::PropertyValue > * >( 0 ) ) - ), + uno::Sequence< beans::PropertyValue > * >( 0 ) ) ); - /////////////////////////////////////////////////////////////// - // Optional standard commands - /////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// + // Optional standard commands + /////////////////////////////////////////////////////////////// - com::sun::star::ucb::CommandInfo( + aCmdInfo[ 4 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ), -1, - getCppuBooleanType() - ), - com::sun::star::ucb::CommandInfo( + getCppuBooleanType() ); + aCmdInfo[ 5 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), -1, getCppuType( static_cast< - com::sun::star::ucb::InsertCommandArgument * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( + ucb::InsertCommandArgument * >( 0 ) ) ); + aCmdInfo[ 6 ] = + ucb::CommandInfo( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), -1, getCppuType( static_cast< - com::sun::star::ucb::OpenCommandArgument2 * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), - -1, - getCppuType( static_cast< - com::sun::star::ucb::TransferInfo * >( 0 ) ) - ) + ucb::OpenCommandArgument2 * >( 0 ) ) ); - /////////////////////////////////////////////////////////////// - // New commands - /////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// + // New commands + /////////////////////////////////////////////////////////////// - /* - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COPY" ) ), - -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MOVE" ) ), + aCmdInfo[ 7 ] = + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "post" ) ), -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - ) - */ - }; + getCppuType( static_cast< + ucb::PostCommandArgument2 * >( 0 ) ) ); - return uno::Sequence< com::sun::star::ucb::CommandInfo >( - aFolderCommandInfoTable, 8 ); + sal_Bool bFolder = sal_False; + + try + { + bFolder = isFolder( xEnv ); } - else + catch ( uno::Exception const & ) { - //================================================================= - // - // Document: Supported commands - // - //================================================================= + return aCmdInfo; + } - static com::sun::star::ucb::CommandInfo aDocumentCommandInfoTable[] = - { - /////////////////////////////////////////////////////////////// - // Required commands - /////////////////////////////////////////////////////////////// + sal_Bool bSupportsLocking = supportsExclusiveWriteLock( xEnv ); - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getCommandInfo" ) ), - -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getPropertySetInfo" ) ), - -1, - getCppuVoidType() - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "getPropertyValues" ) ), - -1, - getCppuType( static_cast< - uno::Sequence< beans::Property > * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "setPropertyValues" ) ), - -1, - getCppuType( static_cast< - uno::Sequence< beans::PropertyValue > * >( 0 ) ) - ), + sal_Int32 nPos = aCmdInfo.getLength(); + sal_Int32 nMoreCmds = ( bFolder ? 2 : 0 ) + ( bSupportsLocking ? 2 : 0 ); + if ( nMoreCmds ) + aCmdInfo.realloc( nPos + nMoreCmds ); + else + return aCmdInfo; - /////////////////////////////////////////////////////////////// - // Optional standard commands - /////////////////////////////////////////////////////////////// + if ( bFolder ) + { + /////////////////////////////////////////////////////////////// + // Optional standard commands + /////////////////////////////////////////////////////////////// - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" ) ), - -1, - getCppuBooleanType() - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), - -1, - getCppuType( static_cast< - com::sun::star::ucb::InsertCommandArgument * >( 0 ) ) - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ), + aCmdInfo[ nPos ] = + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "transfer" ) ), -1, - getCppuType( static_cast< - com::sun::star::ucb::OpenCommandArgument2 * >( 0 ) ) - ), - - /////////////////////////////////////////////////////////////// - // New commands - /////////////////////////////////////////////////////////////// - - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "post" ) ), + getCppuType( static_cast< ucb::TransferInfo * >( 0 ) ) ); + nPos++; + aCmdInfo[ nPos ] = + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "createNewContent" ) ), -1, - getCppuType( static_cast< - com::sun::star::ucb::PostCommandArgument2 * >( 0 ) ) - ) + getCppuType( static_cast< ucb::ContentInfo * >( 0 ) ) ); + nPos++; + } + else + { + // no document-only commands at the moment. + } - /* - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COPY" ) ), + if ( bSupportsLocking ) + { + aCmdInfo[ nPos ] = + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "lock" ) ), -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - ), - com::sun::star::ucb::CommandInfo( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MOVE" ) ), + getCppuVoidType() ); + nPos++; + aCmdInfo[ nPos ] = + ucb::CommandInfo( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unlock" ) ), -1, - getCppuType( static_cast< const rtl::OUString * >( 0 ) ), - ) - */ - }; - - return uno::Sequence< com::sun::star::ucb::CommandInfo >( - aDocumentCommandInfoTable, 8 ); + getCppuVoidType() ); + nPos++; } + return aCmdInfo; } - diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.cxx b/ucb/source/ucp/webdav/webdavdatasupplier.cxx index 39f96256bf23..8d2683939f0d 100644 --- a/ucb/source/ucp/webdav/webdavdatasupplier.cxx +++ b/ucb/source/ucp/webdav/webdavdatasupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavdatasupplier.cxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavdatasupplier.hxx b/ucb/source/ucp/webdav/webdavdatasupplier.hxx index e08e09f875e5..b28263df0201 100644 --- a/ucb/source/ucp/webdav/webdavdatasupplier.hxx +++ b/ucb/source/ucp/webdav/webdavdatasupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavdatasupplier.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx index 9f8a8be9fe50..cc9c69a15e25 100644 --- a/ucb/source/ucp/webdav/webdavprovider.cxx +++ b/ucb/source/ucp/webdav/webdavprovider.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavprovider.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavprovider.hxx b/ucb/source/ucp/webdav/webdavprovider.hxx index 743d9caa2ff8..286f2e474c16 100644 --- a/ucb/source/ucp/webdav/webdavprovider.hxx +++ b/ucb/source/ucp/webdav/webdavprovider.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavprovider.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavresultset.cxx b/ucb/source/ucp/webdav/webdavresultset.cxx index a44bc8c7f278..cf4cc88fd12f 100644 --- a/ucb/source/ucp/webdav/webdavresultset.cxx +++ b/ucb/source/ucp/webdav/webdavresultset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavresultset.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavresultset.hxx b/ucb/source/ucp/webdav/webdavresultset.hxx index 337fb9835560..a438cc208e09 100644 --- a/ucb/source/ucp/webdav/webdavresultset.hxx +++ b/ucb/source/ucp/webdav/webdavresultset.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavresultset.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/source/ucp/webdav/webdavservices.cxx b/ucb/source/ucp/webdav/webdavservices.cxx index 071be9b23492..9fb6d9e82bcf 100644 --- a/ucb/source/ucp/webdav/webdavservices.cxx +++ b/ucb/source/ucp/webdav/webdavservices.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: webdavservices.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java b/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java index d2bdb80f8339..72670bc314dd 100644 --- a/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java +++ b/ucb/test/com/sun/star/comp/ucb/GlobalTransfer_Test.java @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: GlobalTransfer_Test.java,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/test/com/sun/star/comp/ucb/makefile.mk b/ucb/test/com/sun/star/comp/ucb/makefile.mk index 529b2c605114..1f2e35593909 100644 --- a/ucb/test/com/sun/star/comp/ucb/makefile.mk +++ b/ucb/test/com/sun/star/comp/ucb/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobject1.cxx b/ucb/workben/cachemap/cachemapobject1.cxx index 26fc56b72fcd..f37afa981414 100644 --- a/ucb/workben/cachemap/cachemapobject1.cxx +++ b/ucb/workben/cachemap/cachemapobject1.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobject1.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobject1.hxx b/ucb/workben/cachemap/cachemapobject1.hxx index 865747019f81..fe729434471a 100644 --- a/ucb/workben/cachemap/cachemapobject1.hxx +++ b/ucb/workben/cachemap/cachemapobject1.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobject1.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobject2.hxx b/ucb/workben/cachemap/cachemapobject2.hxx index 9292e1453814..812f3b8e8a77 100644 --- a/ucb/workben/cachemap/cachemapobject2.hxx +++ b/ucb/workben/cachemap/cachemapobject2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobject2.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobject3.cxx b/ucb/workben/cachemap/cachemapobject3.cxx index 3c9dc627d873..f8787109e36b 100644 --- a/ucb/workben/cachemap/cachemapobject3.cxx +++ b/ucb/workben/cachemap/cachemapobject3.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobject3.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobject3.hxx b/ucb/workben/cachemap/cachemapobject3.hxx index d9879ebc56c8..1096d3babcc0 100644 --- a/ucb/workben/cachemap/cachemapobject3.hxx +++ b/ucb/workben/cachemap/cachemapobject3.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobject3.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobjectcontainer2.cxx b/ucb/workben/cachemap/cachemapobjectcontainer2.cxx index f5ff3dfc713b..3af959c17cf2 100644 --- a/ucb/workben/cachemap/cachemapobjectcontainer2.cxx +++ b/ucb/workben/cachemap/cachemapobjectcontainer2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobjectcontainer2.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemapobjectcontainer2.hxx b/ucb/workben/cachemap/cachemapobjectcontainer2.hxx index 72bdcaa8fcdc..1ec7cf82936b 100644 --- a/ucb/workben/cachemap/cachemapobjectcontainer2.hxx +++ b/ucb/workben/cachemap/cachemapobjectcontainer2.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemapobjectcontainer2.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/cachemaptest.cxx b/ucb/workben/cachemap/cachemaptest.cxx index 2b84aba382f5..25f10f3318b1 100644 --- a/ucb/workben/cachemap/cachemaptest.cxx +++ b/ucb/workben/cachemap/cachemaptest.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cachemaptest.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/cachemap/makefile.mk b/ucb/workben/cachemap/makefile.mk index a42d7ec5f4d6..53d50fcd2175 100644 --- a/ucb/workben/cachemap/makefile.mk +++ b/ucb/workben/cachemap/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/ucb/makefile.mk b/ucb/workben/ucb/makefile.mk index baf0a11de00d..9a9992a3a7fd 100644 --- a/ucb/workben/ucb/makefile.mk +++ b/ucb/workben/ucb/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/ucb/srcharg.cxx b/ucb/workben/ucb/srcharg.cxx index 091def4c16a5..92b6dd188791 100644 --- a/ucb/workben/ucb/srcharg.cxx +++ b/ucb/workben/ucb/srcharg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: srcharg.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/ucb/srcharg.hxx b/ucb/workben/ucb/srcharg.hxx index 49c8a72db5a3..822c063d5bab 100644 --- a/ucb/workben/ucb/srcharg.hxx +++ b/ucb/workben/ucb/srcharg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: srcharg.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/ucb/workben/ucb/ucbdemo.cxx b/ucb/workben/ucb/ucbdemo.cxx index 45f4e597f60b..f2aa244d2871 100644 --- a/ucb/workben/ucb/ucbdemo.cxx +++ b/ucb/workben/ucb/ucbdemo.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ucbdemo.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify |