problems retrieving active variables

View: New views
1 Messages — Rating Filter:   Alert me  

problems retrieving active variables

by jos.van.den.oever :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I am writing a docker to edit variables and have encountered a problem.
The KoVariableManager does not contain any variables even though the document
does. I was wondering if I am missing something obvious. Here is a code
snippet i use to count the number of variables. This code always returns zero
even when the canvas corresponds  to a loaded KWord document that contains
about 10 variables such as page number and date.
The KoVariableManager instance is always successfully retrieved.

Cheers,
Jos

KoVariableManager* getVariableManager(KoCanvasBase *canvas) {
    if (!canvas) return NULL;
    KoInlineTextObjectManager* inlineManager
        = dynamic_cast<KoInlineTextObjectManager*>(
            canvas->shapeController()->dataCenter("InlineTextObjectManager"));
    if (!inlineManager) {
        return NULL;
    }

    return inlineManager->variableManager();
}

int countVars(KoCanvasBase *canvas)
{
    KoVariableManager *manager = getVariableManager(canvas);
    if (!manager) return 0;
    return manager->variables().size();
}




--
Jos van den Oever, software architect
+49 391 25 19 15 53
http://kogmbh.com/legal/
_______________________________________________
koffice-devel mailing list
koffice-devel@...
https://mail.kde.org/mailman/listinfo/koffice-devel