From koffice-devel Wed Oct 21 17:13:49 2009 From: Jos van den Oever Date: Wed, 21 Oct 2009 17:13:49 +0000 To: koffice-devel Subject: problems retrieving active variables Message-Id: <200910211913.49796.Jos.van.den.Oever () kogmbh ! com> X-MARC-Message: https://marc.info/?l=koffice-devel&m=125614526403473 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( 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