diff --git a/odk/docs/sdk_styles.css b/odk/docs/sdk_styles.css index d1cd9408bea8..5be9eb78c772 100644 --- a/odk/docs/sdk_styles.css +++ b/odk/docs/sdk_styles.css @@ -876,7 +876,8 @@ hr { border-color: #CCCCCC; border-spacing: 0; border-collapse: collapse; - padding: 4; } + padding: 4; + color: #000000; } .cell20 { width: 20%; border-width: 2px; @@ -884,7 +885,8 @@ hr { border-color: #CCCCCC; border-spacing: 0; border-collapse: collapse; - padding: 4; } + padding: 4; + color: #000000; } .cell80 { width: 80%; border-width: 2px; @@ -892,7 +894,8 @@ hr { border-color: #CCCCCC; border-spacing: 0; border-collapse: collapse; - padding: 4; } + padding: 4; + color: #000000; } .cell85 { width: 85%; border-width: 2px; @@ -900,7 +903,8 @@ hr { border-color: #CCCCCC; border-spacing: 0; border-collapse: collapse; - padding: 4; } + padding: 4; + color: #000000;} .nothing1 { width: 20; height: 1; } @@ -941,8 +945,8 @@ hr { font-weight: bold; } .thead { font-weight: bold; - background-image:url(../docs/images/bg_table.png); - backgorund-position: middle; } + background-color:#18a303; + background-position: middle; } .navigate { border: 0; } diff --git a/odk/examples/examples.html b/odk/examples/examples.html index ed6669582cb6..0c9c6b1e35b1 100644 --- a/odk/examples/examples.html +++ b/odk/examples/examples.html @@ -1,6 +1,6 @@ - OpenOffice.org %PRODUCT_RELEASE% SDK - Examples + LibreOffice %PRODUCT_RELEASE% SDK - Examples @@ -10,7 +10,7 @@ - + @@ -75,6 +75,11 @@ + + + + + @@ -364,6 +369,60 @@ + + + + + + + +
Set of simple and more complex examples which shows the use of the API from Java.
Python examplesSmall set of examples which shows the use of the API from Python.
C++ examples
+ + + + + + + + + + +
+ + + + + + + + +
Python examples + + +
+
+ + + + + + + + + + + +
ExampleDescription
ToolPanelPocThis extension illustrates how to create a ToolPanel in Calc.
+
+ + + + +
+

No Additional information

+
+
+
diff --git a/odk/examples/python/toolpanel/CalcWindowState.xcu b/odk/examples/python/toolpanel/CalcWindowState.xcu new file mode 100644 index 000000000000..5da57d7e2400 --- /dev/null +++ b/odk/examples/python/toolpanel/CalcWindowState.xcu @@ -0,0 +1,48 @@ + + + + + + + + ToolPanel Proof of Concept + + + true + + + + + diff --git a/odk/examples/python/toolpanel/Factory.xcu b/odk/examples/python/toolpanel/Factory.xcu new file mode 100644 index 000000000000..e7ca0d81eca4 --- /dev/null +++ b/odk/examples/python/toolpanel/Factory.xcu @@ -0,0 +1,53 @@ + + + + + + + + toolpanel + + + myToolPanelPoc + + + + + + org.libreoffice.example.toolpanel.pocFactory + + + + + diff --git a/odk/examples/python/toolpanel/META-INF/manifest.xml b/odk/examples/python/toolpanel/META-INF/manifest.xml new file mode 100644 index 000000000000..d545ad0a2efb --- /dev/null +++ b/odk/examples/python/toolpanel/META-INF/manifest.xml @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/odk/examples/python/toolpanel/description.xml b/odk/examples/python/toolpanel/description.xml new file mode 100755 index 000000000000..f910e7ee5710 --- /dev/null +++ b/odk/examples/python/toolpanel/description.xml @@ -0,0 +1,32 @@ + + + + + + diff --git a/odk/examples/python/toolpanel/toolPanelPocBasic/Module1.xba b/odk/examples/python/toolpanel/toolPanelPocBasic/Module1.xba new file mode 100644 index 000000000000..9d44f7f011b6 --- /dev/null +++ b/odk/examples/python/toolpanel/toolPanelPocBasic/Module1.xba @@ -0,0 +1,29 @@ + + + +global theDialog + + +Sub dialogOnLoad(event) + + theDialog = event.source + +End Sub + +sub buttonClick(event) + + + theButton = theDialog.getControl("CommandButton1") + theTextField = theDialog.getControl("TextInfo") + + colors = Array(rgb(255,0,0),rgb(0,255,0),rgb(0,0,255)) + rank = getSystemTicks() mod 3 + + theDialog.Model.BackgroundColor = colors(rank) + theTextField.text = cstr(Now) + chr(10)+"Color " + cstr(rank) + " randomly applied" + + theButton.label = "Click Me to change color" + + +end sub + \ No newline at end of file diff --git a/odk/examples/python/toolpanel/toolPanelPocBasic/dialog.xlb b/odk/examples/python/toolpanel/toolPanelPocBasic/dialog.xlb new file mode 100644 index 000000000000..a738363ea7af --- /dev/null +++ b/odk/examples/python/toolpanel/toolPanelPocBasic/dialog.xlb @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/odk/examples/python/toolpanel/toolPanelPocBasic/script.xlb b/odk/examples/python/toolpanel/toolPanelPocBasic/script.xlb new file mode 100644 index 000000000000..4d9cc4d51545 --- /dev/null +++ b/odk/examples/python/toolpanel/toolPanelPocBasic/script.xlb @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/odk/examples/python/toolpanel/toolpanel.component b/odk/examples/python/toolpanel/toolpanel.component new file mode 100644 index 000000000000..225e4f1c65c1 --- /dev/null +++ b/odk/examples/python/toolpanel/toolpanel.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/odk/examples/python/toolpanel/toolpanel.py b/odk/examples/python/toolpanel/toolpanel.py new file mode 100644 index 000000000000..31fce5103a89 --- /dev/null +++ b/odk/examples/python/toolpanel/toolpanel.py @@ -0,0 +1,148 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Laurent Godard +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# inspired from core/testautomation/extensions/optional/input/extension_sources/TaskPaneComponent +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +import uno +import unohelper + +from com.sun.star.ui import XUIElementFactory +from com.sun.star.ui import XUIElement +from com.sun.star.ui.UIElementType import TOOLPANEL as unoTOOLPANEL +from com.sun.star.ui import XToolPanel + +implementation_name = "org.libreoffice.example.toolpanel.pocFactory" # as defined in Factory.xcu +implementation_services = ("org.libreoffice.example.toolpanel.pocFactory",) + +xdlPath = "toolpanels/poc.xdl" # the path inside the oxt +extensionID = "org.libreoffice.example.toolpanel" # as defined in description.xml + +######################################################################## +######################################################################## + +class pocToolPanel( unohelper.Base, XToolPanel ): + + def __init__ ( self, xPanelWindow, ctx ): + + self.ctx = ctx + self.PanelWindow = xPanelWindow + self.Window = xPanelWindow + + def createAccessible( self, i_parentAccessible ): + + return self.PanelWindow + +######################################################################## +######################################################################## + +class pyPanel( unohelper.Base, XUIElement ): + + def __init__ ( self, ctx, xFrame, xParentWindow, url ): + + self.ctx = ctx + self.xParentWindow = xParentWindow + self.toolpanel = None + self.m_panelRootWindow = None + + self.Frame = xFrame + self.ResourceURL = url + self.Type = unoTOOLPANEL + + + def getRealInterface( self ): + + if not self.toolpanel: + rootWindow = self.getOrCreatePanelRootWindow() + self.toolpanel = pocToolPanel(rootWindow, self.ctx) + + return self.toolpanel + + def getOrCreatePanelRootWindow( self ): + + pip = self.ctx.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider" ) + s = pip.getPackageLocation(extensionID) + dialogUrl = s + "/" + xdlPath + + provider = self.ctx.ServiceManager.createInstanceWithContext("com.sun.star.awt.ContainerWindowProvider",self.ctx) + self.m_panelRootWindow = provider.createContainerWindow(dialogUrl,"",self.xParentWindow, None) + + return self.m_panelRootWindow + + def postDisposing( self ): + + super.postDisposing() + + if self.m_panelRootWindow: + self.m_panelRootWindow.dispose() + self.m_panelRootWindow = None + + self.toolpanel = None + + return + +####################################################################### +####################################################################### + +class pocFactory( unohelper.Base, XUIElementFactory ): + + def __init__ ( self, ctx ): + + self.ctx = ctx + + def createUIElement( self, url, properties ): + + xParentWindow = None + xFrame = None + xUIElement = None + + for arg in properties: + if arg.Name == "Frame": + xFrame = arg.Value + elif arg.Name == "ParentWindow": + xParentWindow = arg.Value + + if xFrame and xParentWindow: + try: + xUIElement = pyPanel(self.ctx, xFrame, xParentWindow, url) + except Exception as e: + print(e) + + return xUIElement + +######################################################################## +######################################################################## + +# pythonloader looks for a static g_ImplementationHelper variable +g_ImplementationHelper = unohelper.ImplementationHelper () + +# add the FormatFactory class to the implementation container, +# which the loader uses to register/instantiate the component. +g_ImplementationHelper.addImplementation (pocFactory, + implementation_name, + implementation_services, + ) + diff --git a/odk/examples/python/toolpanel/toolpanels/poc.xdl b/odk/examples/python/toolpanel/toolpanels/poc.xdl new file mode 100755 index 000000000000..2e07cd628791 --- /dev/null +++ b/odk/examples/python/toolpanel/toolpanels/poc.xdl @@ -0,0 +1,11 @@ + + + + + + + + + + +