diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-06 12:32:16 +0000 |
---|---|---|
committer | Ariel Constenla-Haile <arielch@apache.org> | 2012-12-06 12:32:16 +0000 |
commit | dd4d5758ae650a9b11205cf382d80fa344d357b6 (patch) | |
tree | 57183afe4afcfe45dbea0de4e56d48f8e59e4ae3 /odk | |
parent | 0a78e6e85d8e921705b7ea90038f822d47fb58ab (diff) |
#i121442# - Add a StatusbarController example replacing the existing ".uno:ModifiedStatus" in Writer
Notes
Notes:
ignore: reverted
Diffstat (limited to 'odk')
20 files changed, 1871 insertions, 0 deletions
diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/LICENSE b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/LICENSE new file mode 100644 index 000000000000..6af7155a67ee --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2011, 2012 Apache Software Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/Makefile b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/Makefile new file mode 100644 index 000000000000..3a490bf9abdc --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/Makefile @@ -0,0 +1,227 @@ +#************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#************************************************************** + +PRJ=../../../.. +SETTINGS=$(PRJ)/settings + +include $(SETTINGS)/settings.mk +include $(SETTINGS)/std.mk +include $(SETTINGS)/dk.mk +include $(SETTINGS)/platform.mk + +include project.mk + +COMP_NAME=ModifiedStatusController + +OUT_COMP_INC=$(OUT_INC)/$(COMP_NAME) +OUT_COMP_GEN=$(OUT_MISC)/$(COMP_NAME) +OUT_COMP_SLO=$(OUT_SLO)/$(COMP_NAME) +OUT_COMP_LIB=$(SHAREDLIB_OUT)/$(COMP_NAME) +OUT_COMP_BIN=$(OUT_BIN)/$(COMP_NAME) +OUT_COMP_DEPLOY=$(OUT_DEPLOY)/$(COMP_NAME) + +COMP_IMPL_NAME=$(COMP_NAME).uno.$(SHAREDLIB_EXT) +COMP_PACKAGE_FILENAME=$(COMP_NAME)-$(EXTENSION_VERSION)-$(subst _,-,$(EXTENSION_PLATFORM)).$(UNOOXT_EXT) +COMP_PACKAGE = $(OUT_COMP_BIN)/$(COMP_PACKAGE_FILENAME) +COMP_PACKAGE_URL = $(subst \\,\,"$(COMP_PACKAGE)") +COMP_UNOPKG_MANIFEST = $(OUT_COMP_GEN)/$(COMPONENT_NAME)/META-INF/manifest.xml +COMP_UNOPKG_DESCRIPTION = $(OUT_COMP_GEN)/$(COMPONENT_NAME)/description.xml +COMP_MAPFILE = $(OUT_COMP_GEN)/$(COMP_NAME).uno.map +COMP_COMPONENTS = $(OUT_COMP_GEN)/$(COMP_NAME).components + +# xcu +COMP_ADDONS_CFG=registry/data/org/openoffice/Office/Addons.xcu +COMP_CONTROLLER_CFG=registry/data/org/openoffice/Office/UI/Controller.xcu + +DESCRIPTION_IDENTIFIER=$(EXTENSION_ID) +DESCRIPTION_PLATFORM=$(TARGET_PLATFORM) +DESCRIPTION_UPDATE_FILENAME=$(EXTENSION_PLATFORM)-update.xml + +# Allow deploying the extension when running it +ENV_USER_INSTALL=-env:"UserInstallation=$(URLPREFIX)$(OUT_COMP_DEPLOY)" +OFFICE_START_OPTIONS=-nologo -nofirststartwizard -norestore -quickstart=no -writer +OXT_DEPLOYEDFLAG=$(OUT_COMP_GEN)/so_deployed_$(COMP_NAME).flag + +# Files +COMP_CXXFILES = \ + StatusbarController.cxx \ + ModifiedStatusbarController.cxx \ + compfactory.cxx + +COMP_SLOFILES = $(patsubst %.cxx,$(OUT_COMP_SLO)/%.$(OBJ_EXT),$(COMP_CXXFILES)) + +CC_DEFINES+= \ + -DSTATUSBAR_CONTROLLER_IMPL_NAME=\"$(STATUSBARCONTROLLER_IMPLNAME)\" \ + -DSTATUSBAR_CONTROLLER_SERVICE_NAME=\"$(STATUSBARCONTROLLER_SERVICE_NAME)\" \ + -DEXTENSION_IDENTIFIER=\"$(EXTENSION_ID)\" + + +# Targets and rules +.PHONY: ALL update-desc ModifiedStatusController ModifiedStatusController.run +ALL : \ + update-desc \ + ModifiedStatusController + +include $(SETTINGS)/stdtarget.mk + +$(OUT_COMP_SLO)/%.$(OBJ_EXT) : %.cxx $(SDKTYPEFLAG) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(CC) $(CC_FLAGS) $(STL_INCLUDES) $(CC_INCLUDES) -I$(OUT_COMP_INC) $(CC_DEFINES) $(CC_OUTPUT_SWITCH)$(subst /,$(PS),$@) $< + + +ifeq "$(OS)" "WIN" +$(OUT_COMP_LIB)/%.$(SHAREDLIB_EXT) : $(COMP_SLOFILES) + -$(MKDIR) $(subst /,$(PS),$(@D)) + -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)) + $(LINK) \ + $(COMP_LINK_FLAGS) \ + /OUT:$@ \ + /MAP:$(OUT_COMP_GEN)/$(subst $(SHAREDLIB_EXT),map,$(@F)) \ + $(COMP_SLOFILES) \ + $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) $(STLPORTLIB) \ + msvcrt.lib kernel32.lib + $(LINK_MANIFEST) +else +$(OUT_COMP_LIB)/%.$(SHAREDLIB_EXT) : $(COMP_SLOFILES) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(LINK) $(COMP_LINK_FLAGS) $(LINK_LIBS) -o $@ $(COMP_SLOFILES) \ + $(CPPUHELPERLIB) $(CPPULIB) $(SALLIB) \ + $(STLPORTLIB) $(STC++LIB) $(CPPUHELPERDYLIB) $(CPPUDYLIB) $(SALDYLIB) +ifeq "$(OS)" "MACOSX" + $(INSTALL_NAME_URELIBS) $@ +endif +endif + + +# rule for extension Addons.xcu +$(OUT_COMP_GEN)/$(COMP_ADDONS_CFG) : $(COMP_ADDONS_CFG) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#PROTOCOLHANDLER_PROTOCOL#/$(PROTOCOLHANDLER_PROTOCOL)/" > $@ + + +# rule for extension Addons.xcu +$(OUT_COMP_GEN)/$(COMP_CONTROLLER_CFG) : $(COMP_CONTROLLER_CFG) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#PROTOCOLHANDLER_PROTOCOL#/$(PROTOCOLHANDLER_PROTOCOL)/" \ + -e "s/#STATUSBARCONTROLLER_IMPLNAME#/$(STATUSBARCONTROLLER_IMPLNAME)/" > $@ + +# rule for extension description.xml +$(COMP_UNOPKG_DESCRIPTION) : xml/description.xml + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#EXTENSION_VERSION#/$(EXTENSION_VERSION)/" \ + -e "s/#DESCRIPTION_IDENTIFIER#/$(DESCRIPTION_IDENTIFIER)/" \ + -e "s/#EXTENSION_PLATFORM#/$(EXTENSION_PLATFORM)/" \ + -e "s/#DESCRIPTION_OOO_MIN_VER#/$(DESCRIPTION_OOO_MIN_VER)/" \ + -e "s/#DESCRIPTION_DEP_NAME#/$(DESCRIPTION_DEP_NAME)/" \ + -e "s/#DESCRIPTION_PUBLISHER_URL#/$(subst /,\/,$(DESCRIPTION_PUBLISHER_URL))/" \ + -e "s/#DESCRIPTION_PUBLISHER_NAME#/$(DESCRIPTION_PUBLISHER_NAME)/" \ + -e "s/#DESCRIPTION_DISPLAY_NAME#/$(DESCRIPTION_DISPLAY_NAME)/" \ + -e "s/#DESCRIPTION_UPDATE#/$(subst /,\/,$(DESCRIPTION_UPDATE_BASEURL)$(DESCRIPTION_UPDATE_FILENAME))/" > $@ + + +# rule for update description +$(OUT_COMP_BIN)/$(DESCRIPTION_UPDATE_FILENAME) : xml/update.xml + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#DESCRIPTION_IDENTIFIER#/$(DESCRIPTION_IDENTIFIER)/" \ + -e "s/#EXTENSION_VERSION#/$(EXTENSION_VERSION)/" \ + -e "s/#DESCRIPTION_PUBLISHER_URL#/$(subst /,\/,$(DESCRIPTION_PUBLISHER_URL))/" \ + -e "s/#DESCRIPTION_PUBLISHER_NAME#/$(DESCRIPTION_PUBLISHER_NAME)/" \ + -e "s/#UPDATE_DOWNLOAD#/$(subst /,\/,$(UPDATE_DOWNLOAD_BASE)$(COMP_PACKAGE_FILENAME))/" \ + -e "s/#RELEASE_NOTES#/$(subst /,\/,$(RELEASE_NOTES))/" > $@ + +# rule for component package manifest +$(COMP_UNOPKG_MANIFEST) : xml/manifest.xml + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#COMP_NAME#/$(COMP_NAME)/" \ + -e "s/#UNOPKG_PLATFORM#/$(UNOPKG_PLATFORM)/" > $@ + +# rule for component pasive registration +$(COMP_COMPONENTS) : xml/components.xml + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_CAT) $< | $(SDK_SED) \ + -e "s/#STATUSBARCONTROLLER_IMPLNAME#/$(STATUSBARCONTROLLER_IMPLNAME)/" \ + -e "s/#UNOPKG_PLATFORM#/$(UNOPKG_PLATFORM)/" \ + -e "s/#COMP_IMPL_NAME#/$(COMP_IMPL_NAME)/" > $@ + +$(OUT_COMP_GEN)/images/%.png : images/%.png + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$@) + +$(OUT_COMP_GEN)/description/%.txt : description/%.txt + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$@) + +# rule for component package file +$(COMP_PACKAGE) : $(OUT_COMP_LIB)/$(COMP_IMPL_NAME) \ + $(OUT_COMP_GEN)/$(COMP_ADDONS_CFG) \ + $(OUT_COMP_GEN)/$(COMP_CONTROLLER_CFG) \ + $(COMP_UNOPKG_MANIFEST) \ + $(COMP_COMPONENTS) \ + $(COMP_UNOPKG_DESCRIPTION) \ + LICENSE \ + $(OUT_COMP_GEN)/images/icon.png \ + $(OUT_COMP_GEN)/images/icon_hc.png \ + $(OUT_COMP_GEN)/images/statusbaricon.png \ + $(OUT_COMP_GEN)/description/description_en-US.txt + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) + $(COPY) $(subst /,$(PS),$<) $(subst /,$(PS),$(OUT_COMP_GEN)/$(UNOPKG_PLATFORM)) + -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_GEN)/LICENSE) + $(COPY) $(subst /,$(PS),LICENSE) $(subst /,$(PS),$(OUT_COMP_GEN)/LICENSE/) + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -u $(COMP_PACKAGE) $(COMP_NAME).components description.xml + cd $(subst /,$(PS),$(OUT_COMP_GEN)) && $(SDK_ZIP) -ur $(COMP_PACKAGE) $(UNOPKG_PLATFORM)/ LICENSE/ META-INF/ registry/ images/ description/ + + +update-desc : $(OUT_COMP_BIN)/$(DESCRIPTION_UPDATE_FILENAME) + +ModifiedStatusController : $(COMP_PACKAGE) + @echo -------------------------------------------------------------------------------- + @echo Please use the following command to deploy the example! + @echo - + @echo $(MAKE) ModifiedStatusController.run + @echo - + @echo -------------------------------------------------------------------------------- + +ModifiedStatusController.run: $(OXT_DEPLOYEDFLAG) + "$(OFFICE_PROGRAM_PATH)$(PS)soffice" $(OFFICE_START_OPTIONS) $(ENV_USER_INSTALL) + +$(OXT_DEPLOYEDFLAG) : $(COMP_PACKAGE) + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(OUT_COMP_DEPLOY)) + $(DEPLOYTOOL) $(COMP_PACKAGE_URL) $(ENV_USER_INSTALL) + @echo flagged > $(subst /,$(PS),$@) + +.PHONY: clean +clean : + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_INC)) + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_GEN)) + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_SLO)) + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_LIB)) + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_BIN)) + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_COMP_DEPLOY)) diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.cxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.cxx new file mode 100644 index 000000000000..e542498892f3 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.cxx @@ -0,0 +1,259 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "ModifiedStatusbarController.hxx" +#include "defines.hxx" + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/graphic/GraphicType.hpp> +#include <com/sun/star/awt/ImageDrawMode.hpp> + +using namespace framework::statusbar_controller_modified; + +using namespace com::sun::star::uno; +using namespace com::sun::star::ui; +using namespace com::sun::star::awt; +using namespace com::sun::star::graphic; +using namespace com::sun::star::frame; +using namespace com::sun::star::beans; + +using rtl::OUString; + +namespace +{ + static OUString st_ModifiedStatusCmd = OUSTR_COMMAND_UNO_MODIFIED_STATUS; + static Size st_GraphicSize; + + struct StaticStatusGraphic + : public rtl::Static< Reference< XGraphic >, StaticStatusGraphic > + { + }; + + struct StaticSupportedServices + : public rtl::StaticWithInit< Sequence< OUString >, StaticSupportedServices > + { + + Sequence< OUString > + operator( )( ) + { + Sequence< OUString > aServices( 2 ); + aServices[0] = C2U( STATUSBAR_CONTROLLER_SERVICE_NAME ); + aServices[1] = C2U( "com.sun.star.frame.StatusbarController" ); + return aServices; + } + }; +} + +ModifiedStatusbarController::ModifiedStatusbarController( + const Reference< XComponentContext> &rxContext ) + : ModifiedStatusbarController_Base( ) + , m_bEnabled( false ) + , m_bModifiedStatusEnabled( false ) + , m_bIsDocumentModified( false ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::ModifiedStatusbarController" ); + m_xContext = rxContext; + + Reference< XGraphic > &xGraphic = StaticStatusGraphic::get( ); + if ( !xGraphic.is( ) ) + { + try + { + Reference< XGraphicProvider > xProvider( + m_xContext->getServiceManager( )->createInstanceWithContext( + OUSTR_SERVICENAME_GRAPHICPROVIDER, m_xContext ), + UNO_QUERY_THROW ); + + Sequence< PropertyValue > aMediaProps( 1 ); + aMediaProps[0].Name = C2U( "URL" ); + aMediaProps[0].Value <<= C2U( "vnd.sun.star.extension://" EXTENSION_IDENTIFIER "/images/statusbaricon.png" ); + + xGraphic.set( xProvider->queryGraphic( aMediaProps ) ); + Reference< XPropertySet > xGraphicProps( xGraphic, UNO_QUERY_THROW ); + xGraphicProps->getPropertyValue( C2U( "SizePixel" ) ) >>= st_GraphicSize; + + OSL_ENSURE( st_GraphicSize.Height > 0 && st_GraphicSize.Width > 0, "Empty status bar graphic!" ); + } + catch ( const Exception &e ) + { + DISPLAY_EXCEPTION_ENSURE( ModifiedStatusbarController, ModifiedStatusbarController, e ); + } + } +} + +ModifiedStatusbarController::~ModifiedStatusbarController( ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::~ModifiedStatusbarController" ); +} + +void SAL_CALL +ModifiedStatusbarController::statusChanged( + const FeatureStateEvent &aFeatureState ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::statusChanged" ); + osl::ResettableMutexGuard aGuard( m_aMutex ); + + if ( aFeatureState.FeatureURL.Complete.equals( st_ModifiedStatusCmd ) ) + { + OUString sTip; + if ( ( m_bModifiedStatusEnabled = aFeatureState.IsEnabled ) ) + { + OUString aStrValue; + if ( aFeatureState.State >>= aStrValue ) + { + m_bIsDocumentModified = aStrValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "*" ) ); + } + + if ( m_bIsDocumentModified ) + sTip = C2U( "The document is modified. Double-click to save it" ); + else + sTip = C2U( "The document is not modified." ); + } + + m_xStatusbarItem->setQuickHelpText( sTip ); + m_xStatusbarItem->setAccessibleName( sTip ); + m_xStatusbarItem->repaint( ); + } +} + +void SAL_CALL +ModifiedStatusbarController::initialize( + const Sequence< Any > &aArguments ) +throw ( Exception, RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::initialize" ); + ModifiedStatusbarController_Base::initialize( aArguments ); + + osl::MutexGuard aGuard( m_aMutex ); + m_aListenerMap.insert( URLToDispatchMap::value_type( st_ModifiedStatusCmd, Reference< XDispatch > ( ) ) ); +} + +void SAL_CALL +ModifiedStatusbarController::paint( + const Reference< XGraphics > &xGraphics, + const Rectangle &rOutputRectangle, + ::sal_Int32 /*nStyle*/ ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::paint" ); + Reference< XGraphic > &xGraphic = StaticStatusGraphic::get( ); + Reference< XStatusbarItem> xSbItem; + + osl::ClearableMutexGuard aGuard( m_aMutex ); + xSbItem = m_xStatusbarItem; + bool bEnabled = m_bModifiedStatusEnabled && m_bIsDocumentModified; + aGuard.clear( ); + + if ( !xSbItem.is() || !xGraphics.is() ) + return; + + if ( xGraphic.is() && xGraphic->getType() != GraphicType::EMPTY ) + { + sal_Int32 nOffset = xSbItem->getOffset( ); + Point aPos; + aPos.X = ( rOutputRectangle.Width + nOffset ) / 2 - st_GraphicSize.Width / 2; + aPos.Y = rOutputRectangle.Height / 2 - st_GraphicSize.Height / 2; + + xGraphics->drawImage( rOutputRectangle.X + aPos.X, + rOutputRectangle.Y + aPos.Y, + st_GraphicSize.Width, + st_GraphicSize.Height, + bEnabled ? ImageDrawMode::NONE : ImageDrawMode::DISABLE, + xGraphic ); + } + else + { + xGraphics->clear( rOutputRectangle ); + } +} + +void SAL_CALL +ModifiedStatusbarController::doubleClick( + const Point &/*aPos*/ ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::doubleClick" ); + osl::ClearableMutexGuard aGuard( m_aMutex ); + if ( !m_bIsDocumentModified ) + return; + aGuard.clear( ); + + static const Sequence< PropertyValue > aDummyArgs; + Execute( OUSTR_COMMAND_UNO_SAVE, aDummyArgs ); +} + +OUString SAL_CALL +ModifiedStatusbarController::getImplementationName( ) +throw ( RuntimeException ) +{ + return getImplementationName_static( ); +} + +::sal_Bool SAL_CALL +ModifiedStatusbarController::supportsService( + const OUString &ServiceName ) +throw ( RuntimeException ) +{ + const Sequence< OUString > &aServices = StaticSupportedServices::get( ); + + for ( const OUString *pService = aServices.getConstArray( ), + *pEnd = pService + aServices.getLength( ); + pService != pEnd; + pService++ ) + { + if ( pService->equals( ServiceName ) ) + return sal_True; + } + + return sal_False; +} + +Sequence< OUString > SAL_CALL +ModifiedStatusbarController::getSupportedServiceNames( ) +throw ( RuntimeException ) +{ + return getSupportedServiceNames_static( ); +} + +Reference< XInterface > +ModifiedStatusbarController::Create( + const Reference< XComponentContext > &rxContext ) +throw ( Exception ) +{ + OSL_TRACE( "sbctlmodif::ModifiedStatusbarController::Create" ); + return Reference< XInterface > ( static_cast < cppu::OWeakObject * > ( new ModifiedStatusbarController( rxContext ) ) ); +} + +Sequence< OUString > +ModifiedStatusbarController::getSupportedServiceNames_static( ) +{ + return StaticSupportedServices::get( ); +} + +OUString +ModifiedStatusbarController::getImplementationName_static( ) +{ + static OUString st_ImplName( RTL_CONSTASCII_USTRINGPARAM( STATUSBAR_CONTROLLER_IMPL_NAME ) ); + return st_ImplName; +} + diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.hxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.hxx new file mode 100644 index 000000000000..2f29ba9fd32a --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/ModifiedStatusbarController.hxx @@ -0,0 +1,65 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef MODIFIEDSTATUSBARCONTROLLER_HXX +#define MODIFIEDSTATUSBARCONTROLLER_HXX + +#include "StatusbarController.hxx" + +#include <cppuhelper/implbase1.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace framework +{ + namespace statusbar_controller_modified + { + typedef cppu::ImplInheritanceHelper1< StatusbarController, com::sun::star::lang::XServiceInfo > + ModifiedStatusbarController_Base; + + class ModifiedStatusbarController : public ModifiedStatusbarController_Base + { + public: + explicit ModifiedStatusbarController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> &rxContext ); + ~ModifiedStatusbarController(); + + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > &xGraphics, const ::com::sun::star::awt::Rectangle &rOutputRectangle, ::sal_Int32 nStyle ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point &aPos ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent &aFeatureState ) throw ( ::com::sun::star::uno::RuntimeException ); + 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 ); + + 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 ); + + static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > Create( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > &rxContext ) throw ( com::sun::star::uno::Exception ); + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(); + static ::rtl::OUString getImplementationName_static(); + + private: + bool m_bEnabled; + bool m_bModifiedStatusEnabled; + bool m_bIsDocumentModified; + }; + } +} + +#endif diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.cxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.cxx new file mode 100644 index 000000000000..c60fcdbbe1e3 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.cxx @@ -0,0 +1,540 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "StatusbarController.hxx" +#include "defines.hxx" + +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/ui/ItemStyle.hpp> +#include <com/sun/star/ucb/AlreadyInitializedException.hpp> + +#include <functional> +#include <algorithm> + +using namespace framework::statusbar_controller_modified; + +using namespace com::sun::star; +using namespace com::sun::star::ui; +using namespace com::sun::star::util; +using namespace com::sun::star::uno; +using namespace com::sun::star::awt; +using namespace com::sun::star::frame; +using namespace com::sun::star::beans; + +using rtl::OUString; +using com::sun::star::ucb::AlreadyInitializedException; + +namespace +{ + template< class MAP > + struct lcl_StatusListenerRemove + : public std::unary_function< typename MAP::value_type &, void > + { + private: + Reference< XStatusListener > xListener; + Reference< XURLTransformer > xURLTransformer; + public: + explicit lcl_StatusListenerRemove( + const Reference< XStatusListener > &rxListener, + const Reference< XURLTransformer > &rxTransformer ) + : xListener( rxListener ) + , xURLTransformer( rxTransformer ) {} + + void operator()( typename MAP::value_type &rPair ) const + { + if ( !rPair.second.is() ) + return; + try + { + URL aURL; + aURL.Complete = rPair.first; + xURLTransformer->parseStrict( aURL ); + rPair.second->removeStatusListener( xListener, aURL ); + } + catch ( ... ) + { + } + + rPair.second.clear(); + } + }; +} + + +StatusbarController::StatusbarController() + : StatusbarController_Base( m_aMutex ) + , m_bInitialized( false ) + , m_bOwnerDraw( false ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::StatusbarController" ); +} + +StatusbarController::~StatusbarController() +{ + OSL_TRACE( "sbctlmodif::StatusbarController::~StatusbarController" ); +} + +void SAL_CALL +StatusbarController::dispose() +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::dispose" ); + osl::ClearableMutexGuard aGuard( m_aMutex ); + ThrowIfDisposed(); + + UnbindListeners(); + + m_xFrame.clear(); + m_xStatusbarWindow.clear(); + m_xStatusbarItem.clear(); + m_xURLTransformer.clear(); + m_aListenerMap.clear(); + aGuard.clear(); + + StatusbarController_Base::dispose(); +} + +void SAL_CALL +StatusbarController::initialize( + const Sequence< Any > &aArguments ) +throw ( Exception, RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::initialize" ); + bool bInitialized( true ); + + osl::ResettableMutexGuard aGuard( m_aMutex ); + bInitialized = m_bInitialized; + aGuard.clear(); + + if ( bInitialized ) + throw AlreadyInitializedException(); + + Reference< XFrame > xFrame; + Reference< XWindow > xStatusbarWindow; + Reference< XStatusbarItem > xStatusbarItem; + OUString sCommand, sModuleId; + bool bOwnerDraw( false ); + + PropertyValue aPropVal; + for ( const Any *pAny = aArguments.getConstArray(), + *pEnd = pAny + aArguments.getLength(); + pAny != pEnd; + pAny++ ) + { + if ( *pAny >>= aPropVal ) + { + if ( aPropVal.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Frame" ) ) ) + aPropVal.Value >>= xFrame; + else if ( aPropVal.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CommandURL" ) ) ) + aPropVal.Value >>= sCommand; + else if ( aPropVal.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ParentWindow" ) ) ) + aPropVal.Value >>= xStatusbarWindow; + else if ( aPropVal.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ModuleName" ) ) ) + aPropVal.Value >>= sModuleId; + else if ( aPropVal.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StatusbarItem" ) ) ) + aPropVal.Value >>= xStatusbarItem; + } + } + + if ( ( xStatusbarItem->getStyle() & ItemStyle::OWNER_DRAW ) == ItemStyle::OWNER_DRAW ) + bOwnerDraw = true; + + aGuard.reset(); + m_bInitialized = true; + m_xFrame = xFrame; + m_xStatusbarItem = xStatusbarItem; + m_xStatusbarWindow = xStatusbarWindow; + m_sModuleIdentifier = sModuleId; + m_sCommandURL = sCommand; + m_bOwnerDraw = bOwnerDraw; + if ( m_sCommandURL.getLength() ) + m_aListenerMap.insert( URLToDispatchMap::value_type( m_sCommandURL, Reference< XDispatch >() ) ); + aGuard.clear(); +} + +void StatusbarController::BindListeners() +{ + OSL_TRACE( "sbctlmodif::StatusbarController::BindListeners" ); + std::vector< Listener > aListeners; + Reference< XStatusListener > xStatusListener; + OUString sOwnCommandURL; + + osl::ClearableMutexGuard aGuard( m_aMutex ); + if ( !m_bInitialized ) + return; + + sOwnCommandURL = m_sCommandURL; + xStatusListener.set( static_cast< cppu::OWeakObject *>( this ), UNO_QUERY ); + Reference< XDispatchProvider > xProvider( m_xFrame, UNO_QUERY ); + if ( xProvider.is() ) + { + for ( URLToDispatchMap::iterator it = m_aListenerMap.begin(); + it != m_aListenerMap.end(); it++ ) + { + Reference< XURLTransformer > xURLTransformer = GetURLTransformer(); + URL aURL; + aURL.Complete = it->first; + xURLTransformer->parseStrict( aURL ); + + // remove + if ( it->second.is() ) + { + try + { + it->second->removeStatusListener( xStatusListener, aURL ); + } + catch ( ... ) {} + + it->second.clear(); + } + + // requery + try + { + it->second = xProvider->queryDispatch( aURL, OUString(), 0 ); + } + catch ( ... ) {} + + aListeners.push_back( Listener( aURL, it->second ) ); + } + } + aGuard.clear(); + + if ( !xStatusListener.is() || aListeners.empty() ) + return; + + for ( std::vector< Listener >::const_iterator it = aListeners.begin(); + it != aListeners.end(); it++ ) + { + try + { + if ( it->xDispatch.is() ) + it->xDispatch->addStatusListener( xStatusListener, it->aURL ); + else if ( it->aURL.Complete.equals( sOwnCommandURL ) ) + { + // no dispatch for our own command, + // send an update with the Feature disabled + FeatureStateEvent aFeatureState; + aFeatureState.FeatureURL = it->aURL; + aFeatureState.IsEnabled = sal_False; + aFeatureState.Source = xStatusListener; + + xStatusListener->statusChanged( aFeatureState ); + } + } + catch ( ... ) + {} + } + +} + +void StatusbarController::UnbindListeners() +{ + OSL_TRACE( "sbctlmodif::StatusbarController::UnbindListeners" ); + + Reference< XStatusListener > xStatusListener( static_cast< cppu::OWeakObject * >( this ), UNO_QUERY ); + std::for_each( m_aListenerMap.begin(), + m_aListenerMap.end(), + lcl_StatusListenerRemove< URLToDispatchMap >( xStatusListener, GetURLTransformer() ) ); +} + +bool StatusbarController::IsBound() const +{ + OSL_TRACE( "sbctlmodif::StatusbarController::IsBound" ); + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_bInitialized ) + return false; + + const URLToDispatchMap::const_iterator it = m_aListenerMap.find( m_sCommandURL ); + return it != m_aListenerMap.end() && it->second.is(); +} + +Reference< XURLTransformer > StatusbarController::GetURLTransformer() +{ + osl::MutexGuard aGuard( m_aMutex ); + if ( !m_xURLTransformer.is() && m_xContext.is() ) + { + try + { + m_xURLTransformer.set( + m_xContext->getServiceManager()->createInstanceWithContext( + OUSTR_SERVICENAME_URLTRANSFORMER, m_xContext ), UNO_QUERY_THROW ); + } + catch ( ... ) + {} + } + + return m_xURLTransformer; +} + +void +StatusbarController::ThrowIfDisposed( ) throw ( RuntimeException ) +{ + if ( rBHelper.bDisposed || rBHelper.bInDispose ) + throw lang::DisposedException( ); +} + +void StatusbarController::Execute( + const Sequence< PropertyValue > &aArgs ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::Execute" ); + Reference< XDispatch > xDispatch; + Reference< XURLTransformer > xURLParser; + OUString sCommandURL; + + osl::ClearableMutexGuard aGuard( m_aMutex ); + ThrowIfDisposed(); + if ( m_bInitialized && m_sCommandURL.getLength() ) + { + sCommandURL = m_sCommandURL; + xURLParser = GetURLTransformer(); + const URLToDispatchMap::const_iterator it = m_aListenerMap.find( m_sCommandURL ); + if ( it != m_aListenerMap.end() ) + xDispatch = it->second; + } + aGuard.clear(); + + if ( xDispatch.is() && xURLParser.is() ) + { + try + { + URL aURL; + aURL.Complete = sCommandURL; + xURLParser->parseStrict( aURL ); + xDispatch->dispatch( aURL, aArgs ); + } + catch ( ... ) + {} + } +} + +void StatusbarController::Execute( + const OUString &rCommandURL, + const Sequence< PropertyValue > &aArgs ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::Execute" ); + Reference< XDispatch > xDispatch; + URL aURL; + aURL.Complete = rCommandURL; + + osl::ClearableMutexGuard aGuard( m_aMutex ); + ThrowIfDisposed(); + if ( m_bInitialized && rCommandURL.getLength() ) + { + Reference< XURLTransformer > xURLParser = GetURLTransformer(); + xURLParser->parseStrict( aURL ); + + const URLToDispatchMap::const_iterator it = m_aListenerMap.find( rCommandURL ); + if ( it != m_aListenerMap.end() ) + xDispatch = it->second; + + if ( !xDispatch.is() ) + { + try + { + Reference< XDispatchProvider > xProvider( m_xFrame, UNO_QUERY_THROW ); + xDispatch = xProvider->queryDispatch( aURL, OUString(), 0 ); + } + catch ( ... ) + {} + } + } + aGuard.clear(); + + if ( xDispatch.is() ) + { + try + { + xDispatch->dispatch( aURL, aArgs ); + } + catch ( ... ) + {} + } +} + +void StatusbarController::UpdateStatus() +{ + BindListeners(); +} + +void StatusbarController::UpdateStatus( const OUString &rCommand ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::UpdateStatus" ); + Reference< XStatusListener > xStatusListener; + Reference< XDispatch > xDispatch; + URL aURL; + aURL.Complete = rCommand; + + osl::ClearableMutexGuard aGuard( m_aMutex ); + Reference< XDispatchProvider > xProvider( m_xFrame, UNO_QUERY ); + Reference< XURLTransformer > xURLParser = GetURLTransformer(); + xStatusListener.set( static_cast< cppu::OWeakObject * >( this ), UNO_QUERY ); + if ( !xProvider.is() || !xURLParser.is() ) + return; + try + { + xURLParser->parseStrict( aURL ); + xDispatch = xProvider->queryDispatch( aURL, OUString(), 0 ); + } + catch ( ... ) + {} + aGuard.clear(); + + if ( !xStatusListener.is() || !xDispatch.is() ) + return; + + try + { + xDispatch->addStatusListener( xStatusListener, aURL ); + xDispatch->removeStatusListener( xStatusListener, aURL ); + } + catch ( ... ) + {} +} + +void SAL_CALL +StatusbarController::statusChanged( + const FeatureStateEvent &aFeatureState ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::statusChanged" ); + osl::ClearableMutexGuard aGuard( m_aMutex ); + + if ( rBHelper.bInDispose || rBHelper.bDisposed ) + return; + + if ( aFeatureState.FeatureURL.Complete.equals( m_sCommandURL ) ) + { + OUString aStrVal; + if ( aFeatureState.State >>= aStrVal ) + { + m_xStatusbarItem->setText( aStrVal ); + } + else if ( !aFeatureState.State.hasValue() && !aFeatureState.IsEnabled ) + m_xStatusbarItem->setText( OUString() ); + } +} + +void SAL_CALL +StatusbarController::disposing( + const lang::EventObject &Source ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::disposing" ); + osl::MutexGuard aGuard( m_aMutex ); + + if ( rBHelper.bInDispose || rBHelper.bDisposed ) + return; + + Reference< XFrame > xFrame( Source.Source, UNO_QUERY ); + if ( xFrame.is() ) + { + if ( xFrame == m_xFrame ) + m_xFrame.clear(); + return; + } + + Reference< XDispatch > xDispatch( Source.Source, UNO_QUERY ); + if ( !xDispatch.is() ) + return; + + URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); + while ( pIter != m_aListenerMap.end() ) + { + // Compare references and release dispatch references if they are equal. + if ( xDispatch == pIter->second ) + pIter->second.clear(); + pIter++; + } +} + +void SAL_CALL +StatusbarController::update() +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::update" ); + osl::ClearableMutexGuard aGuard( m_aMutex ); + ThrowIfDisposed(); + aGuard.clear(); + + BindListeners(); +} + +::sal_Bool SAL_CALL +StatusbarController::mouseButtonDown( const MouseEvent &/*aMouseEvent*/ ) +throw ( RuntimeException ) +{ + return sal_False; +} + +::sal_Bool SAL_CALL +StatusbarController::mouseMove( const MouseEvent &/*aMouseEvent*/ ) +throw ( RuntimeException ) +{ + return sal_False; +} + +::sal_Bool SAL_CALL +StatusbarController::mouseButtonUp( const MouseEvent &/*aMouseEvent*/ ) +throw ( RuntimeException ) +{ + return sal_False; +} + +void SAL_CALL +StatusbarController::command( + const Point &/*aPos*/, + ::sal_Int32 /*nCommand*/, + ::sal_Bool /*bMouseEvent*/, + const Any &/*aData*/ ) +throw ( RuntimeException ) +{ +} + +void SAL_CALL +StatusbarController::paint( + const Reference< XGraphics > &/*xGraphics*/, + const Rectangle &/*rOutputRectangle*/, + ::sal_Int32 /*nStyle*/ ) +throw ( RuntimeException ) +{ +} + +void SAL_CALL +StatusbarController::click( const ::com::sun::star::awt::Point &/*aPos*/ ) +throw ( RuntimeException ) +{ +} + +void SAL_CALL +StatusbarController::doubleClick( const ::com::sun::star::awt::Point &/*aPos*/ ) +throw ( RuntimeException ) +{ + OSL_TRACE( "sbctlmodif::StatusbarController::doubleClick" ); + osl::ClearableMutexGuard aGuard( m_aMutex ); + if ( rBHelper.bDisposed || rBHelper.bInDispose ) + return; + aGuard.clear(); + + Sequence< PropertyValue > aDummyArgs; + Execute( aDummyArgs ); +} diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.hxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.hxx new file mode 100644 index 000000000000..dca177251dc6 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/StatusbarController.hxx @@ -0,0 +1,124 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef STATUSBARCONTROLLER_HXX +#define STATUSBARCONTROLLER_HXX + +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/ui/XStatusbarItem.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XStatusbarController.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <map> + +namespace framework +{ + namespace statusbar_controller_modified + { + typedef cppu::WeakComponentImplHelper1 < com::sun::star::frame::XStatusbarController > StatusbarController_Base; + + class StatusbarController : protected cppu::BaseMutex, + public StatusbarController_Base + { + public: + explicit StatusbarController(); + virtual ~StatusbarController(); + + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // com::sun::star::frame::XStatusbarController Methods + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent &aMouseEvent ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent &aMouseEvent ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent &aMouseEvent ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point &aPos, ::sal_Int32 nCommand, ::sal_Bool bMouseEvent, const ::com::sun::star::uno::Any &aData ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > &xGraphics, const ::com::sun::star::awt::Rectangle &rOutputRectangle, ::sal_Int32 nStyle ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL click( const ::com::sun::star::awt::Point &aPos ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL doubleClick( const ::com::sun::star::awt::Point &aPos ) throw ( ::com::sun::star::uno::RuntimeException ); + + // com::sun::star::frame::XStatusListener Methods + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent &State ) throw ( ::com::sun::star::uno::RuntimeException ); + + // com::sun::star::lang::XEventListener Methods + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &Source ) throw ( ::com::sun::star::uno::RuntimeException ); + + // com::sun::star::util::XUpdatable Methods + virtual void SAL_CALL update() throw ( ::com::sun::star::uno::RuntimeException ); + + // com::sun::star::lang::XInitialization Methods + 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 ); + + protected: + + struct Listener + { + + explicit Listener( + const ::com::sun::star::util::URL &rURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > &rDispatch ) + : aURL( rURL ) + , xDispatch( rDispatch ) + { + } + + ::com::sun::star::util::URL aURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; + }; + + typedef ::std::map< ::rtl::OUString, com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > > URLToDispatchMap; + + void ThrowIfDisposed() throw ( com::sun::star::uno::RuntimeException ); + void BindListeners(); + void UnbindListeners(); + bool IsBound() const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > GetURLTransformer(); + // execute methods + void Execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aArgs ); + void Execute( const rtl::OUString &rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aArgs ); + void UpdateStatus(); + void UpdateStatus( const rtl::OUString &rCommand ); + + bool m_bInitialized; + bool m_bOwnerDraw; + rtl::OUString m_sModuleIdentifier; + rtl::OUString m_sCommandURL; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xStatusbarWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XStatusbarItem > m_xStatusbarItem; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + + URLToDispatchMap m_aListenerMap; + }; + } +} + +#endif /* STATUSBARCONTROLLER_HXX */ + diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/compfactory.cxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/compfactory.cxx new file mode 100644 index 000000000000..47db358fc0d3 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/compfactory.cxx @@ -0,0 +1,62 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "ModifiedStatusbarController.hxx" + +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implementationentry.hxx> + +namespace framework +{ + namespace statusbar_controller_modified + { + static ::cppu::ImplementationEntry const s_impl_entries[] = + { + { + ModifiedStatusbarController::Create, + ModifiedStatusbarController::getImplementationName_static, + ModifiedStatusbarController::getSupportedServiceNames_static, + ::cppu::createSingleComponentFactory, + 0, + 0 + }, + { 0, 0, 0, 0, 0, 0 } + }; + } +} + +extern "C" +{ + SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, uno_Environment ** ) + { + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + SAL_DLLPUBLIC_EXPORT void *SAL_CALL component_getFactory( + const sal_Char *pImplName, void *pServiceManager, void *pRegistryKey ) + { + return ::cppu::component_getFactoryHelper( pImplName, + pServiceManager, + pRegistryKey , + framework::statusbar_controller_modified::s_impl_entries ); + } +} diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/defines.hxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/defines.hxx new file mode 100644 index 000000000000..af0d1ea9cb35 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/defines.hxx @@ -0,0 +1,45 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef GENERAL_DEFINES_HXX +#define GENERAL_DEFINES_HXX + +#include "macros.hxx" + +#ifndef STATUSBAR_CONTROLLER_IMPL_NAME +#error You must define STATUSBAR_CONTROLLER_IMPL_NAME +#endif + +#ifndef STATUSBAR_CONTROLLER_SERVICE_NAME +#error You must define STATUSBAR_CONTROLLER_SERVICE_NAME +#endif + +#ifndef EXTENSION_IDENTIFIER +#error You must define EXTENSION_IDENTIFIER +#endif + +#define OUSTR_COMMAND_UNO_MODIFIED_STATUS C2U(".uno:ModifiedStatus") +#define OUSTR_COMMAND_UNO_SAVE C2U(".uno:Save") + +#define OUSTR_SERVICENAME_GRAPHICPROVIDER C2U("com.sun.star.graphic.GraphicProvider") +#define OUSTR_SERVICENAME_URLTRANSFORMER C2U("com.sun.star.util.URLTransformer") + +#endif diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/description/description_en-US.txt b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/description/description_en-US.txt new file mode 100644 index 000000000000..ed63ac4eac49 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/description/description_en-US.txt @@ -0,0 +1 @@ +This extension enhances Apache OpenOffice status bar by replacing the Modified status bar item in Apache OpenOffice Writer's status bar.
\ No newline at end of file diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon.png b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon.png Binary files differnew file mode 100644 index 000000000000..31f48ea8fb69 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon.png diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon_hc.png b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon_hc.png Binary files differnew file mode 100644 index 000000000000..3870cc4709d4 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/icon_hc.png diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/statusbaricon.png b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/statusbaricon.png Binary files differnew file mode 100644 index 000000000000..daf585381c7d --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/images/statusbaricon.png diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/macros.hxx b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/macros.hxx new file mode 100755 index 000000000000..c2cb052a449a --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/macros.hxx @@ -0,0 +1,56 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef GENERAL_MACROS_HXX +#define GENERAL_MACROS_HXX + +#define STRINGIFY(x) _STRINGIFY(x) +#define _STRINGIFY(x) #x + +#define C2U( constAsciiStr ) \ + ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) ) ) + +#define U2C( ouString ) \ + ( ::rtl::OUStringToOString( ouString, RTL_TEXTENCODING_ASCII_US ).getStr() ) + +#define GET_STR( OUSTR ) \ + ::rtl::OUStringToOString( OUSTR, RTL_TEXTENCODING_ASCII_US ).getStr() + + +#if OSL_DEBUG_LEVEL > 0 +#define DISPLAY_EXCEPTION_ENSURE( ClassName, MethodName, e ) \ + ::rtl::OString sMessage( #ClassName "::" #MethodName ": caught an exception!\n" ); \ + sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_UTF8 ); \ + OSL_ENSURE( sal_False, sMessage.getStr() ) +#else +#define DISPLAY_EXCEPTION_ENSURE( ClassName, MethodName, e ) ((void)e) +#endif + +#if OSL_DEBUG_LEVEL > 0 +#define DISPLAY_EXCEPTION( ClassName, MethodName, e ) \ + ::rtl::OString sMessage( #ClassName "::" #MethodName ": caught an exception!\n" ); \ + sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_UTF8 ); \ + OSL_TRACE( sMessage.getStr() ) +#else +#define DISPLAY_EXCEPTION( ClassName, MethodName, e ) ((void)e) +#endif + +#endif diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/project.mk b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/project.mk new file mode 100644 index 000000000000..631ff8148825 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/project.mk @@ -0,0 +1,40 @@ +#************************************************************** +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +#************************************************************** + +DESCRIPTION_OOO_MIN_VER=3.5.0 +DESCRIPTION_DEP_NAME=OpenOffice.org $(DESCRIPTION_OOO_MIN_VER) + +EXTENSION_ID=org.apache.openoffice.framework.statusbar.ModifiedStatus +EXTENSION_VERSION=0.0.1 + +DESCRIPTION_PUBLISHER_URL=http://www.openoffice.org/api +DESCRIPTION_PUBLISHER_NAME=Apache OpenOffice +DESCRIPTION_DISPLAY_NAME=Document Modified StatusBar Control + +DESCRIPTION_UPDATE_BASEURL=http://www.openoffice.org/api/dummyupdate +DESCRIPTION_UPDATE_URL=http://www.openoffice.org/api/dummyupdate/update.xml +UPDATE_DOWNLOAD_BASE=http://www.openoffice.org/api/dummydownload/ +RELEASE_NOTES=http://www.openoffice.org/api/dummy_release_notes + +PROTOCOLHANDLER_PROTOCOL=org.apache.openoffice.framework.statusbar.ModifiedStatus + +STATUSBARCONTROLLER_IMPLNAME=org.apache.openoffice.framework.statusbar.comp.ModifiedStatus.StatusbarController +STATUSBARCONTROLLER_SERVICE_NAME=org.apache.openoffice.framework.statusbar.ModifiedStatus.StatusbarController diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/Addons.xcu b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/Addons.xcu new file mode 100644 index 000000000000..afb848c4be34 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/Addons.xcu @@ -0,0 +1,69 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<oor:component-data +xmlns:oor="http://openoffice.org/2001/registry" +xmlns:xs="http://www.w3.org/2001/XMLSchema" +oor:name="Addons" +oor:package="org.openoffice.Office"> + <node oor:name="AddonUI"> + <node oor:name="OfficeStatusbarMerging"> + <node oor:name="org.apache.openoffice.framework.OfficeStatusbarMerging.ModifiedStatus" oor:op="replace"> + <node oor:name="S1" oor:op="replace"> + <prop oor:name="MergePoint"> + <value>.uno:ModifiedStatus</value> + </prop> + <prop oor:name="MergeCommand"> + <value>Replace</value> + </prop> + <prop oor:name="MergeFallback"> + <value>Ignore</value> + </prop> + <prop oor:name="MergeContext" oor:type="xs:string"> + <value>com.sun.star.text.TextDocument</value> + </prop> + <node oor:name="StatusBarItems"> + <node oor:name="M1" oor:op="replace"> + <prop oor:name="Title" oor:type="xs:string"> + <value xml:lang="en-US">Modified Status</value> + </prop> + <prop oor:name="URL" oor:type="xs:string"> + <value>#PROTOCOLHANDLER_PROTOCOL#:ModifiedStatus</value> + </prop> + <prop oor:name="Alignment" oor:type="xs:string"> + <value>center</value> + </prop> + <prop oor:name="AutoSize" oor:type="xs:boolean"> + <value>false</value> + </prop> + <prop oor:name="OwnerDraw" oor:type="xs:boolean"> + <value>true</value> + </prop> + <prop oor:name="Width" oor:type="xs:long"> + <value>16</value> + </prop> + </node> + </node> + </node> + </node> + </node> + </node> +</oor:component-data> diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/UI/Controller.xcu b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/UI/Controller.xcu new file mode 100644 index 000000000000..17bb6966c7e0 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd"> +<oor:component-data oor:name="Controller" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <node oor:name="Registered"> + <node oor:name="StatusBar"> + <node oor:name="org.apache.openoffice.framework.statusbar.ModifiedStatus.StatusbarController" oor:op="replace"> + <prop oor:name="Command"> + <value>#PROTOCOLHANDLER_PROTOCOL#:ModifiedStatus</value> + </prop> + <prop oor:name="Module"> + <value>com.sun.star.text.TextDocument</value> + </prop> + <prop oor:name="Controller"> + <value>#STATUSBARCONTROLLER_IMPLNAME#</value> + </prop> + </node> + </node> + </node> +</oor:component-data> diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/components.xml b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/components.xml new file mode 100644 index 000000000000..9013b3f58819 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/components.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<components xmlns="http://openoffice.org/2010/uno-components"> + <component loader="com.sun.star.loader.SharedLibrary" uri="#UNOPKG_PLATFORM#/#COMP_IMPL_NAME#"> + <implementation name="#STATUSBARCONTROLLER_IMPLNAME#"> + <service name="com.sun.star.frame.StatusbarController"/> + </implementation> + </component> +</components> diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/description.xml b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/description.xml new file mode 100644 index 000000000000..38622412d059 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/description.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> + <version value="#EXTENSION_VERSION#"/> + <identifier value="#DESCRIPTION_IDENTIFIER#"/> + <platform value="#EXTENSION_PLATFORM#"/> + <dependencies> + <OpenOffice.org-minimal-version value="#DESCRIPTION_OOO_MIN_VER#" d:name="#DESCRIPTION_DEP_NAME#"/> + </dependencies> + <publisher> + <name xlink:href="#DESCRIPTION_PUBLISHER_URL#" lang="en">#DESCRIPTION_PUBLISHER_NAME#</name> + </publisher> + <display-name> + <name lang="en-US">#DESCRIPTION_DISPLAY_NAME#</name> + </display-name> + <icon> + <default xlink:href="images/icon.png"/> + <high-contrast xlink:href="images/icon_hc.png"/> + </icon> + <registration> + <simple-license accept-by="admin" default-license-id="lic-en-US" suppress-if-required="true" > + <license-text xlink:href="LICENSE/LICENSE" lang="en-US" license-id="lic-en-US"/> + </simple-license> + </registration> + <extension-description> + <src xlink:href="description/description_en-US.txt" lang="en-US"/> + </extension-description> + <update-information> + <src xlink:href="#DESCRIPTION_UPDATE#" /> + </update-information> +</description> diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/manifest.xml b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/manifest.xml new file mode 100644 index 000000000000..63950dc42b73 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/manifest.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd"> +<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest"> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="registry/data/org/openoffice/Office/Addons.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data" + manifest:full-path="registry/data/org/openoffice/Office/UI/Controller.xcu"/> + <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-components;platform=#UNOPKG_PLATFORM#" + manifest:full-path="#COMP_NAME#.components"/> +</manifest:manifest> diff --git a/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/update.xml b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/update.xml new file mode 100644 index 000000000000..dc33411edfa2 --- /dev/null +++ b/odk/examples/cpp/StatusbarController/ModifiedStatusbarController/xml/update.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--*********************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + ***********************************************************--> +<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> + <identifier value="#DESCRIPTION_IDENTIFIER#"/> + <version value="#EXTENSION_VERSION#"/> + <publisher> + <name xlink:href="#DESCRIPTION_PUBLISHER_URL#" lang="en">#DESCRIPTION_PUBLISHER_NAME#</name> + </publisher> + <update-download> + <src xlink:href="#UPDATE_DOWNLOAD#"/> + </update-download> + <release-notes> + <src xlink:href="#RELEASE_NOTES#" lang="en"/> + </release-notes> +</description> |