Esempio n. 1
0
 def testInvoke( self ):
     self.failUnless( 5 == uno.invoke( self.tobj , "transportAny" , (uno.Any("byte", 5),) ) )
     self.failUnless( 5 == uno.invoke(
         PythonTransporter(), "transportAny" , (uno.Any( "byte", 5 ),) ) )
     t = uno.getTypeByName( "long" )
     mystruct = uno.createUnoStruct(
         "com.sun.star.beans.PropertyValue", "foo",0,uno.Any(t,2),0 )
     mystruct.Value = uno.Any(t, 1)
Esempio n. 2
0
	def actionPerformed(self, ev):
		logging.info("KBU: actionPerformed IncludeActionListener")
		ignoreSelection = getListSelections(self.ignoreM).values()  # to be included
		ignoreMsgs = { msg
			       for msg in getListValues(self.ignoreM).values()
			       if msg not in ignoreSelection }
		includeMsgs = set(ignoreSelection).union(getListValues(self.includeM).values())
		uno.invoke(self.ignoreM, "setPropertyValue", ("StringItemList", uno.Any("[]string", tuple(sorted(ignoreMsgs)))))
		uno.invoke(self.includeM, "setPropertyValue", ("StringItemList", uno.Any("[]string", tuple(sorted(includeMsgs)))))
    def test_checkIndexedPropertyValues(self):

        xServiceManager = self.xContext.ServiceManager
        xCont = xServiceManager.createInstanceWithContext(
            'com.sun.star.document.IndexedPropertyValues', self.xContext)

        p1 = PropertyValue(Name="Jupp", Value="GoodGuy")
        prop1 = uno.Any("[]com.sun.star.beans.PropertyValue", (p1, ))

        p2 = PropertyValue(Name="Horst", Value="BadGuy")
        prop2 = uno.Any("[]com.sun.star.beans.PropertyValue", (p2, ))

        p3 = PropertyValue(Name="Peter", Value="FamilyGuy")
        prop3 = uno.Any("[]com.sun.star.beans.PropertyValue", (p3, ))

        t = xCont.getElementType()
        self.assertEqual(0, xCont.getCount(), "Initial container is not empty")
        uno.invoke(xCont, "insertByIndex", (0, prop1))

        ret = xCont.getByIndex(0)
        self.assertEqual(p1.Name, ret[0].Name)
        self.assertEqual(p1.Value, ret[0].Value)

        uno.invoke(xCont, "replaceByIndex", (0, prop2))
        ret = xCont.getByIndex(0)
        self.assertEqual(p2.Name, ret[0].Name)
        self.assertEqual(p2.Value, ret[0].Value)

        xCont.removeByIndex(0)
        self.assertTrue(not (xCont.hasElements()) and xCont.getCount() == 0,
                        "Could not remove PropertyValue")
        uno.invoke(xCont, "insertByIndex", (0, prop1))
        uno.invoke(xCont, "insertByIndex", (1, prop2))
        self.assertTrue(xCont.hasElements() and xCont.getCount() == 2,
                        "Did not insert PropertyValue")

        uno.invoke(xCont, "insertByIndex", (1, prop2))
        uno.invoke(xCont, "insertByIndex", (1, prop3))
        ret = xCont.getByIndex(1)
        self.assertEqual(p3.Name, ret[0].Name)
        self.assertEqual(p3.Value, ret[0].Value)

        with self.assertRaises(IndexOutOfBoundsException):
            uno.invoke(xCont, "insertByIndex", (25, prop2))

        with self.assertRaises(IndexOutOfBoundsException):
            xCont.removeByIndex(25)

        with self.assertRaises(IllegalArgumentException):
            uno.invoke(xCont, "insertByIndex", (3, "Example String"))
Esempio n. 4
0
    def _createSpecificProperty(self, filter_name):
        """Creates a property according to the filter"""
        import uno
        from com.sun.star.beans import PropertyValue
        if filter_name == "impress_html_Export":
            property = PropertyValue(
                'FilterData', 0,
                uno.Any(
                    '[]com.sun.star.beans.PropertyValue',
                    (
                        PropertyValue('IsExportNotes', 0, True, 0),
                        PropertyValue('PublishMode', 0, 0, 0),
                        PropertyValue('Width', 0, 640, 0),
                        PropertyValue('Format', 0, 2, 0),
                    ),
                ), 0)
        elif filter_name == "impress_pdf_Export":
            property = PropertyValue(
                'FilterData', 0,
                uno.Any(
                    '[]com.sun.star.beans.PropertyValue',
                    (
                        PropertyValue('ExportNotesPages', 0, True, 0),
                        PropertyValue('SelectPdfVersion', 0, 1, 0),
                    ),
                ), 0)
        elif "pdf_Export" in filter_name:
            property = PropertyValue(
                'FilterData', 0,
                uno.Any(
                    '[]com.sun.star.beans.PropertyValue',
                    (PropertyValue('SelectPdfVersion', 0, 1, 0), ),
                ), 0)
        elif filter_name in ("draw_html_Export", "HTML (StarCalc)"):
            property = PropertyValue(
                'FilterData', 0,
                uno.Any(
                    '[]com.sun.star.beans.PropertyValue',
                    (PropertyValue('Format', 0, 2, 0), ),
                ), 0)
        elif filter_name == "Text (encoded)":
            property = PropertyValue('FilterFlags', 0, 'UTF8,LF', 0)
        else:
            return []

        return [
            property,
        ]
 def generateTestContentIndex(self, doc):
     index = doc.createInstance("com.sun.star.text.ContentIndex")
     for i in range(10):
         styles = ('n' + str(i), )
         uno.invoke(index.LevelParagraphStyles, "replaceByIndex",
                    (i, uno.Any("[]string", styles)))
     return index
Esempio n. 6
0
    def saveAs(self, outFile):
        def createProps(**args):
            props = []
            for key in args:
                prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
                prop.Name = key
                prop.Value = args[key]
                props.append(prop)
            return tuple(props)

        # See: https://github.com/LibreOffice/core/blob/master/filter/source/pdf/pdfexport.cxx#L444
        if outFile.upper().endswith('.PDF'):
            settings = createProps(
                ExportBookmarks=True,
                ExportNotes=True,
            )

            args = createProps(FilterName="writer_pdf_Export",
                               FilterData=uno.Any(
                                   "[]com.sun.star.beans.PropertyValue",
                                   settings))
        elif outFile.upper().endswith('.ODT'):
            args = ()
        elif outFile.upper().endswith('.OTS'):
            args = ()
        elif outFile.upper().endswith('.DOCX'):
            args = ()
        else:
            raise RuntimeError('Unknown output file format.')

        self._doc.storeToURL(self._convertToURL(os.path.realpath(outFile)),
                             args)
def save_as_PDF_75dpi(*args):
    """save current document as PDF file

        images will be reduced to 75dpi (JPG compression)
    """
    # https://wiki.openoffice.org/wiki/API/Tutorials/PDF_export
    filter_data = {
        # General properties
        'UseLosslessCompression': True,
        'Quality': 100,
        'ReduceImageResolution': True,
        'MaxImageResolution': 75,  # 75, 150, 300, 600, 1200
        'ExportBookmarks': True,
        'EmbedStandardFonts': True,
        # Links
        'ExportBookmarksToPDFDestination': True,
        'ConvertOOoTargetToPDFTarget': True,
        'ExportLinksRelativeFsys': True,
        'PDFViewSelection': 2,
        # Security
        # ...
    }

    additional_properties = []
    p = PropertyValue()
    p.Name = 'FilterData'
    p.Value = uno.Any("[]com.sun.star.beans.PropertyValue",
                      tuple(convert_dict_to_PropertyValue_List(filter_data)))
    additional_properties.append(p)

    save_as('pdf',
            url_addition='__75dpi',
            additional_properties=additional_properties)
Esempio n. 8
0
    def testCustomProperties(self):
        uiComponent = self.ui_test._xContext.ServiceManager.createInstanceWithContext(
            "com.sun.star.comp.Writer.EPUBExportUIComponent",
            self.ui_test._xContext)

        # Make sure that by default the version is not altered.
        propertyValues = uiComponent.getPropertyValues()
        filterData = [
            i.Value for i in propertyValues if i.Name == "FilterData"
        ][0]
        self.assertEqual(
            0, len([i.Value for i in filterData if i.Name == "EPUBVersion"]))

        # But if we set it explicitly, then it's retained, even without interacting with the UI.
        filterData = (PropertyValue(Name="EPUBVersion", Value=30), )
        propertyValues = (PropertyValue(
            Name="FilterData",
            Value=uno.Any("[]com.sun.star.beans.PropertyValue", filterData)), )
        uiComponent.setPropertyValues(propertyValues)
        propertyValues = uiComponent.getPropertyValues()
        filterData = [
            i.Value for i in propertyValues if i.Name == "FilterData"
        ][0]
        epubVersion = [i.Value for i in filterData
                       if i.Name == "EPUBVersion"][0]
        self.assertEqual(30, epubVersion)
Esempio n. 9
0
 def position_context_changed(self):
     try:
         self.menu_containers.clear()
         position_context, ref = self.get_position_context()
         try:
             self.category_popups = get_config(self.ctx, 
                 "/org.openoffice.Office.UI.%s/UserInterface/Popups" % ref)
             self.category_commands = get_config(self.ctx, 
                 "/org.openoffice.Office.UI.%s/UserInterface/Commands" % ref)
         except:
             pass
         manager = self.config_supplier.getUIConfigurationManager(
             position_context)
         self.menu_settings = manager.getSettings(
                 "private:resource/menubar/menubar", False)
         items = []
         self.get_submenus(items, self.menu_containers, "", "", self.menu_settings)
         #print(items)
         list_menu = self.get(3, self.ID_LIST_MENU)
         list_menu_model = list_menu.getModel()
         list_menu_model.StringItemList = uno.Any("[]string", 
             tuple([item[1] for item in items]))
         for i, item in enumerate(items):
             list_menu_model.setItemData(i, item[0])
         list_menu.selectItemPos(list_menu.getItemCount()-1, True)
     except Exception as e:
         print(e)
Esempio n. 10
0
    def export_active_sheet_to_pdf(self, dest: 'path_to_pdf_file'):
        """notes: assuming the area of the active sheet to be printed is
    'a1:h30'
    """

        active_sheet = self.model.getCurrentController().getActiveSheet()

        # have to select the area to be printed
        fdata = []
        fdata1 = PropertyValue()
        fdata1.Name = 'Selection'
        oCellRange = active_sheet.getCellRangeByName('a1:h30')
        fdata1.Value = oCellRange
        fdata.append(fdata1)

        args = []
        arg1 = PropertyValue()
        arg1.Name = 'FilterName'
        arg1.Value = 'calc_pdf_Export'
        arg2 = PropertyValue()
        arg2.Name = 'FilterData'
        arg2.Value = uno.Any("[]com.sun.star.beans.PropertyValue",
                             tuple(fdata))
        args.append(arg1)
        args.append(arg2)

        self.model.storeToURL('file:///' + dest, tuple(args))
    def tstDoc(self):
        try:
            props = [("ReadOnly", True)]
            loadProps = tuple([self.mkPropertyValue(name, value) for (name, value) in props])

            m_xMSF = self.xContext.ServiceManager
            desktop = m_xMSF.createInstanceWithContext('com.sun.star.frame.Desktop', self.xContext)

            filepath = os.path.abspath("FIXME")
            if os.name == "nt":
                sourceFile = "file:///" + filepath + "/" + quote(self.fileName)
            else:
                sourceFile = "file://" + quote(filepath) + "/" + quote(self.fileName)
            self.xDoc = desktop.loadComponentFromURL(sourceFile, "_blank", 0, loadProps)
            assert(self.xDoc)

            if os.name == "nt":
                targetFile = "file:///" + self.m_TargetDir + quote(self.m_SourceDir) + "/" + quote(self.fileName)
            else:
                targetFile = "file://" +
                            quote(self.m_TargetDir) +
                            quote(self.m_SourceDir) +
                            "/" +
                            quote(self.fileName)

            p1 = PropertyValue()
            PropValue = uno.Any("[]com.sun.star.beans.PropertyValue", (p1,))
            uno.invoke(self.xDoc, "storeToURL", (targetFile, PropValue))
Esempio n. 12
0
 def actionPerformed(self, actionEvent):
     try:
         if self.xRB_m.getState():
             self.sSelectedDic = 'moderne'
         elif self.xRB_c.getState():
             self.sSelectedDic = 'classique'
         elif self.xRB_r.getState():
             self.sSelectedDic = 'reforme1990'
         elif self.xRB_t.getState():
             self.sSelectedDic = 'toutesvariantes'
         else:
             # no dictionary selected
             pass
         if self.sSelectedDic and self.sSelectedDic != self.sCurrentDic:
             # Modify the registry
             xSettings = helpers.getConfigSetting(
                 "/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr",
                 True)
             xLocations = xSettings.getByName("Locations")
             v1 = xLocations[0].replace(self.sCurrentDic, self.sSelectedDic)
             v2 = xLocations[1].replace(self.sCurrentDic, self.sSelectedDic)
             #xSettings.replaceByName("Locations", xLocations)  # doesn't work, see line below
             uno.invoke(xSettings, "replaceByName",
                        ("Locations", uno.Any("[]string", (v1, v2))))
             xSettings.commitChanges()
         self.xContainer.endExecute()
     except:
         traceback.print_exc()
Esempio n. 13
0
    def saveByStream(self, filter_name=None):
        """
        Downloads document from office service
        """
        self._updateDocument()
        outputStream = OutputStreamWrapper(False)
        properties = {"OutputStream": outputStream}
        properties.update({"FilterName": filter_name})
        if filter_name == 'Text - txt - csv (StarCalc)':
            properties.update({"FilterOptions": CSVFilterOptions})
        props = self._toProperties(**properties)
        # PDF/A format # TODO: make it configurable from client side
        if filter_name == 'writer_pdf_Export':
            props += (PropertyValue(
                "FilterData", 0,
                uno.Any(
                    "[]com.sun.star.beans.PropertyValue",
                    self._toProperties(SelectPdfVersion=1),
                ), 0), )

        try:
            #url = uno.systemPathToFileUrl(path) #when storing to filesystem
            self.document.storeToURL('private:stream', props)
        except Exception as exception:
            exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
            traceback.print_exception(exceptionType,
                                      exceptionValue,
                                      exceptionTraceback,
                                      limit=2,
                                      file=sys.stdout)
        openDocumentBytes = outputStream.data.getvalue()
        outputStream.close()
        return openDocumentBytes
 def generateTestContentIndex(self, doc):
     index = getContentIndexInstance(doc)
     for i in range(10):
         styles = ('n' + str(i), )
         uno.invoke(index.LevelParagraphStyles, "replaceByIndex",
                    (i, uno.Any("[]string", styles)))
     return index
Esempio n. 15
0
 def __init__(self, ctx, configuration, controller):
     self.ctx = ctx
     self.Configuration = configuration
     self.Wizard = createService(self.ctx, 'com.sun.star.ui.dialogs.Wizard')
     arguments = ((uno.Any('[][]short', (g_wizard_paths)), controller), )
     uno.invoke(self.Wizard, 'initialize', arguments)
     self.stringResource = getStringResource(self.ctx, g_identifier,
                                             'OAuth2OOo')
Esempio n. 16
0
 def get_target(self):
     try:
         if self.type.getTypeClass() == TypeClass.SEQUENCE:
             return uno.Any(self.type.getName(),
                            self._convert_to_tuple(self.target))
     except Exception as e:
         print(("get_target: " + str(e)))
     return self.target
Esempio n. 17
0
    def test_checkNamedPropertyValues(self):

        xServiceManager = self.xContext.ServiceManager
        xCont = xServiceManager.createInstanceWithContext(
            'com.sun.star.document.NamedPropertyValues', self.xContext)

        p1 = PropertyValue(Name="Jupp", Value="GoodGuy")
        prop1 = uno.Any("[]com.sun.star.beans.PropertyValue", (p1, ))

        p2 = PropertyValue(Name="Horst", Value="BadGuy")
        prop2 = uno.Any("[]com.sun.star.beans.PropertyValue", (p2, ))

        t = xCont.getElementType()
        self.assertFalse(xCont.hasElements(), "Initial container is not empty")

        uno.invoke(xCont, "insertByName", ("prop1", prop1))
        ret = xCont["prop1"]
        self.assertEqual(p1.Name, ret[0].Name)
        self.assertEqual(p1.Value, ret[0].Value)

        uno.invoke(xCont, "replaceByName", ("prop1", prop2))
        ret = xCont["prop1"]
        self.assertEqual(p2.Name, ret[0].Name)
        self.assertEqual(p2.Value, ret[0].Value)

        xCont.removeByName("prop1")
        self.assertFalse(xCont.hasElements(),
                         "Could not remove PropertyValue.")
        uno.invoke(xCont, "insertByName", ("prop1", prop1))
        uno.invoke(xCont, "insertByName", ("prop2", prop2))
        self.assertTrue(xCont.hasElements(), "Did not insert PropertyValue")
        names = xCont.getElementNames()
        self.assertEqual(2, len(names), "Not all element names were returned")

        for i in range(len(names)):
            self.assertIn(names[i], ["prop1", "prop2"],
                          "Got a wrong element name")

        with self.assertRaises(ElementExistException):
            uno.invoke(xCont, "insertByName", ("prop2", prop1))

        with self.assertRaises(IllegalArgumentException):
            uno.invoke(xCont, "insertByName", ("prop3", "Example String"))

        with self.assertRaises(NoSuchElementException):
            xCont.removeByName("prop3")
Esempio n. 18
0
 def _init_ui_1(self, page):
     self.enable_button(3, False)
     pg = page.getControl
     pg(self.ID_COMBO_NAME).addTextListener(self.NameTextListener(self))
     
     self._init_names()
     self.get(1, self.ID_COMBO_NAME).getModel().StringItemList = \
         uno.Any("[]string", tuple([key for key in self.names.keys()]))
Esempio n. 19
0
 def make_prop(self, name, value):
     prop = PropertyValue()
     prop.Name = name
     if isinstance(value, (list, tuple)):
         prop.Value = uno.Any("[]com.sun.star.beans.PropertyValue", value)
     else:
         prop.Value = value
     return prop
Esempio n. 20
0
def _setTitle(source, context, title):
    identifier = source.Identifier
    parent = identifier.getParent()
    count = parent.countChildTitle(title)
    if u'~' in title:
        msg = "Can't set property: Title value: %s contains invalid character: '~'." % title
        level = uno.getConstantByName('com.sun.star.logging.LogLevel.SEVERE')
        data = getPropertyValueSet({
            'Uri': identifier.getContentIdentifier(),
            'ResourceName': title
        })
        error = getInteractiveAugmentedIOException(msg, context, 'ERROR',
                                                   'INVALID_CHARACTER', data)
        result = uno.Any('com.sun.star.ucb.InteractiveAugmentedIOException',
                         error)
    elif (identifier.IsNew and count == 1) or (not identifier.IsNew
                                               and count != 0):
        msg = "Can't set property: %s value: %s - Name Clash Error" % ('Title',
                                                                       title)
        level = uno.getConstantByName('com.sun.star.logging.LogLevel.SEVERE')
        data = getPropertyValueSet({
            'TargetFolderURL':
            parent.getContentIdentifier(),
            'ClashingName':
            title,
            'ProposedNewName':
            '%s(1)' % title
        })
        #data = getPropertyValueSet({'Uri': identifier.getContentIdentifier(),'ResourceName': title})
        error = getInteractiveAugmentedIOException(msg, context, 'ERROR',
                                                   'ALREADY_EXISTING', data)
        result = uno.Any('com.sun.star.ucb.InteractiveAugmentedIOException',
                         error)
    else:
        if identifier.IsNew:
            source.MetaData.insertValue(
                'Title', identifier.setTitle(title, source.IsFolder))
        else:
            default = source.MetaData.getValue('Title')
            source.MetaData.insertValue('Title',
                                        identifier.updateTitle(title, default))
        msg = "Set property: %s value: %s" % ('Title', title)
        level = uno.getConstantByName('com.sun.star.logging.LogLevel.INFO')
        result = None
    return result, level, msg
Esempio n. 21
0
 def toProperties(self, propDict):
     properties = []
     for key in propDict:
         if type(propDict[key]) == dict:
             prop = PropertyValue(key, 0, uno.Any("[]com.sun.star.beans.PropertyValue",self.toProperties(propDict[key])), 0)
         else:
             prop = PropertyValue(key, 0, propDict[key], 0)
         properties.append(prop)
     return tuple(properties)
Esempio n. 22
0
 def convert(self,
             document,
             format=None,
             output_filename=None,
             delete_on_close=True):
     output_filename, format = guess_format_and_filename(
         output_filename, format)
     ### Do the OpenOffice component dance
     context = uno.getComponentContext()
     resolver = context.ServiceManager.createInstanceWithContext(
         'com.sun.star.bridge.UnoUrlResolver', context)
     unocontext = resolver.resolve('uno:%s' % OOO_CONNECTION)
     ### And some more OpenOffice magic
     unosvcmgr = unocontext.ServiceManager
     desktop = unosvcmgr.createInstanceWithContext(
         'com.sun.star.frame.Desktop', unocontext)
     config = unosvcmgr.createInstanceWithContext(
         'com.sun.star.configuration.ConfigurationProvider', unocontext)
     ### Load inputfile
     instream = InputStream(uno.ByteSequence(document.read()))
     inputprops = [
         PropertyValue('InputStream', 0, instream, 0),
     ]
     if document.format == 'html':
         inputprops.append(
             PropertyValue('FilterName', 0, 'HTML (StarWriter)', 0))
     doc = desktop.loadComponentFromURL('private:stream', '_blank', 0,
                                        tuple(inputprops))
     ### Update document links
     # skip ...
     ### Update document indexes
     # skip ...
     ### Write outputfile
     fd = open(output_filename, 'w')
     filter_name = formats[format]
     outputprops = [
         PropertyValue(
             'FilterData', 0,
             uno.Any(
                 '[]com.sun.star.beans.PropertyValue',
                 tuple(),
             ), 0),
         PropertyValue('FilterName', 0, filter_name, 0),
         PropertyValue('OutputStream', 0, OutputStream(fd), 0),
         PropertyValue('Overwrite', 0, True, 0),
     ]
     if filter_name == 'Text (encoded)':
         outputprops.append(PropertyValue('FilterFlags', 0, 'UTF8, LF', 0))
     doc.storeToURL('private:stream', tuple(outputprops))
     doc.dispose()
     doc.close(True)
     fd.close()
     fd = Document(output_filename,
                   mode='r',
                   delete_on_close=delete_on_close)
     return fd
Esempio n. 23
0
def _setPropertyValue(source, context, property):
    name, value = property.Name, property.Value
    if source._propertySetInfo.get(name).Attributes & READONLY:
        msg = "ERROR: Requested property: %s is READONLY" % name
        level = uno.getConstantByName('com.sun.star.logging.LogLevel.SEVERE')
        error = IllegalAccessException(msg, source)
        result = uno.Any('com.sun.star.lang.IllegalAccessException', error)
    else:
        result, level, msg = _setProperty(source, context, name, value)
    return result, level, msg
Esempio n. 24
0
 def generateTestPropertyValues(self, count):
     sm = self.context.ServiceManager
     values = sm.createInstanceWithContext(
         "com.sun.star.document.IndexedPropertyValues", self.context)
     for i in range(count):
         properties = (PropertyValue(Name='n' + str(i),
                                     Value='v' + str(i)), )
         uno.invoke(
             values, "insertByIndex",
             (i, uno.Any("[]com.sun.star.beans.PropertyValue", properties)))
     return values
Esempio n. 25
0
def _setPropertyValue(source, context, property):
    name, value = property.Name, property.Value
    print("Content._setPropertyValue() 1 %s - %s" % (name, value))
    if source.Identifier._propertySetInfo.get(name).Attributes & READONLY:
        msg = "ERROR: Requested property: %s is READONLY" % name
        level = SEVERE
        error = IllegalAccessException(msg, source)
        result = uno.Any('com.sun.star.lang.IllegalAccessException', error)
    else:
        result, level, msg = _setProperty(source, context, name, value)
    return result, level, msg
Esempio n. 26
0
	def __initGcDropdown(self, windowC):
		ignoreM  = windowC.getControl("toggleIdsIgnore").getModel()
		includeM = windowC.getControl("toggleIdsInclude").getModel()
		registryIgnored = readIgnoredRules()
		self.__updateToggleIds(registryIgnored)
		# TODO: Some of these errors.xml messages have
		# non-unique messages. Since there's no way for the
		# user to differentiate them, we can't really do
		# anything except conflate them – unless we append the
		# tid to make them unique?
		ignoreMsgs  = set(msg
				  for (tid, msg) in self.__toggleIds.items()
				  if tid in registryIgnored)
		includeMsgs = set(msg
				  for (tid, msg) in self.__toggleIds.items()
				  if tid not in registryIgnored)
		uno.invoke(ignoreM, "setPropertyValue", ("StringItemList", uno.Any("[]string", tuple(sorted(ignoreMsgs)))))
		uno.invoke(includeM, "setPropertyValue", ("StringItemList", uno.Any("[]string", tuple(sorted(includeMsgs)))))
		# Enable buttons:
		windowC.getControl("addIgnore").addActionListener(IgnoreActionListener(ignoreM, includeM))
		windowC.getControl("addInclude").addActionListener(IncludeActionListener(ignoreM, includeM))
Esempio n. 27
0
 def _toProperties(self, d):
     props = []
     for key in d:
         prop = PropertyValue()
         prop.Name = key
         if isinstance(d[key], dict):
             prop.Value = uno.Any("[]com.sun.star.beans.PropertyValue",
                                  self._toProperties(d[key]))
         else:
             prop.Value = d[key]
         props.append(prop)
     return tuple(props)
Esempio n. 28
0
 def __init__(self, ctx, res={}, title=None, ids=(), titles={}, help_url=None):
     self.ctx = ctx
     self.res = res
     self.title = title
     self.titles = titles
     wizard = self.create_service("com.sun.star.ui.dialogs.Wizard")
     uno.invoke(wizard, "initialize", ((uno.Any("[]short", ids), self),))
     self.wizard = wizard
     if self.title:
         wizard.setTitle(self._(title))
     if help_url:
         wizard.HelpURL = help_url
 def _toProperties(self, options):
     import uno
     from com.sun.star.beans import PropertyValue
     props = []
     for key in options:
         if isinstance(options[key], dict):
             prop = PropertyValue(key, 0, uno.Any("[]com.sun.star.beans.PropertyValue",
                                                  (self._toProperties(options[key]))), 0)
         else:
             prop = PropertyValue(key, 0, options[key], 0)
         props.append(prop)
     return tuple(props)
Esempio n. 30
0
    def createPlaceHolder(self, xmsf, ph, hint):
        try:
            placeHolder = xmsf.createInstance(
                "com.sun.star.text.TextField.JumpEdit")
        except Exception:
            traceback.print_exc()
            return None

        placeHolder.PlaceHolder = ph
        placeHolder.Hint = hint
        placeHolder.PlaceHolderType = uno.Any("short", TEXT)
        return placeHolder