[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    problems retrieving active variables
From:       Jos van den Oever <Jos.van.den.Oever () kogmbh ! com>
Date:       2009-10-21 17:13:49
Message-ID: 200910211913.49796.Jos.van.den.Oever () kogmbh ! com
[Download RAW message or body]

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@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic