devtools: document classes and method, remove unneeded methods
This documents DevTools classes and methods. In addition it also removes some methods that aren't needed anymore. Change-Id: I550e2ce197d1565b4f770eb7dd59b2195f2230a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112379 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
parent
23e07d6b0d
commit
9932cd89ae
@ -13,6 +13,9 @@
|
||||
#include <sfx2/dllapi.h>
|
||||
#include <sfx2/childwin.hxx>
|
||||
|
||||
/**
|
||||
* Necessary child window for the development tools docking window
|
||||
*/
|
||||
class SAL_WARN_UNUSED SFX2_DLLPUBLIC DevelopmentToolChildWindow final : public SfxChildWindow
|
||||
{
|
||||
SFX_DECL_CHILDWINDOW_WITHID(DevelopmentToolChildWindow);
|
||||
|
@ -26,6 +26,11 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
/** Development tool main docking window
|
||||
*
|
||||
* Contains two sides. Left side contains the simplified DOM tree and
|
||||
* the right side the object inspector tree.
|
||||
*/
|
||||
class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
|
||||
{
|
||||
private:
|
||||
@ -39,20 +44,22 @@ private:
|
||||
std::unique_ptr<weld::Toolbar> mpObjectInspectorToolbar;
|
||||
std::unique_ptr<weld::Notebook> mpObjectInspectorNotebook;
|
||||
|
||||
// Reference to the root object for the current document
|
||||
css::uno::Reference<css::uno::XInterface> mxRoot;
|
||||
// Stores the current selected object in the document
|
||||
css::uno::Reference<css::uno::XInterface> mxCurrentSelection;
|
||||
css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
|
||||
css::uno::Reference<css::view::XSelectionSupplier> mxSelectionSupplier;
|
||||
|
||||
// Handler for the DOM tree
|
||||
DocumentModelTreeHandler maDocumentModelTreeHandler;
|
||||
// Handler for the object inspector tree
|
||||
ObjectInspectorTreeHandler maObjectInspectorTreeHandler;
|
||||
|
||||
DECL_LINK(DocumentModelTreeViewSelectionHandler, weld::TreeView&, void);
|
||||
DECL_LINK(SelectionToggled, weld::ToggleButton&, void);
|
||||
|
||||
void inspectDocument();
|
||||
void updateSelection();
|
||||
void inspectSelectionOrRoot();
|
||||
|
||||
public:
|
||||
DevelopmentToolDockingWindow(SfxBindings* pBindings, SfxChildWindow* pChildWindow,
|
||||
@ -64,10 +71,13 @@ public:
|
||||
|
||||
virtual void ToggleFloatingMode() override;
|
||||
|
||||
// Inspect the input object in the object inspector
|
||||
void introspect(css::uno::Reference<css::uno::XInterface> const& xInterface);
|
||||
|
||||
// Signals that the selected object in the document changes
|
||||
void selectionChanged(css::uno::Reference<css::uno::XInterface> const& xInterface);
|
||||
|
||||
// Signals to change to the current selected object in the object inspector
|
||||
void changeToCurrentSelection();
|
||||
};
|
||||
|
||||
|
@ -18,12 +18,19 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
/** Document model tree handler
|
||||
*
|
||||
* Handles the DOM tree part of DevTools, which includes interaction with
|
||||
* the DOM tree view UI elements and the DOM model.
|
||||
*/
|
||||
class DocumentModelTreeHandler
|
||||
{
|
||||
private:
|
||||
std::unique_ptr<weld::TreeView>& mpDocumentModelTree;
|
||||
css::uno::Reference<css::uno::XInterface> mxDocument;
|
||||
|
||||
// Clears all children of a tree node, where the parent is
|
||||
// identified by the input tree iter.
|
||||
void clearChildren(weld::TreeIter const& rParent);
|
||||
|
||||
public:
|
||||
@ -37,6 +44,8 @@ public:
|
||||
static css::uno::Reference<css::uno::XInterface> getObjectByID(OUString const& rID);
|
||||
|
||||
void dispose();
|
||||
|
||||
// selects the input object if it exists in the DOM tree view
|
||||
void selectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,12 @@
|
||||
#include <memory>
|
||||
#include <deque>
|
||||
|
||||
/** Object inspector tree handler
|
||||
*
|
||||
* Handles the object inspector part of DevTools - mainly interaction
|
||||
* between UI objects that consist of the object inspector.
|
||||
*
|
||||
*/
|
||||
class ObjectInspectorTreeHandler
|
||||
{
|
||||
private:
|
||||
@ -33,8 +39,11 @@ private:
|
||||
std::unique_ptr<weld::Toolbar>& mpObjectInspectorToolbar;
|
||||
std::unique_ptr<weld::Notebook>& mpObjectInspectorNotebook;
|
||||
|
||||
// object stack to remember previously inspected objects so it is
|
||||
// possible to return back to them
|
||||
std::deque<css::uno::Any> maInspectionStack;
|
||||
|
||||
// just the current context
|
||||
css::uno::Reference<css::uno::XComponentContext> mxContext;
|
||||
|
||||
static void clearObjectInspectorChildren(std::unique_ptr<weld::TreeView>& pTreeView,
|
||||
@ -50,6 +59,7 @@ private:
|
||||
|
||||
void inspectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
|
||||
|
||||
// Object stack handling
|
||||
void clearStack();
|
||||
void addToStack(css::uno::Any const& rAny);
|
||||
css::uno::Any popFromStack();
|
||||
@ -65,14 +75,23 @@ public:
|
||||
std::unique_ptr<weld::Toolbar>& pObjectInspectorToolbar,
|
||||
std::unique_ptr<weld::Notebook>& pObjectInspectorNotebook);
|
||||
|
||||
// callbacks when a node in the tree view is expanded
|
||||
DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter&, bool);
|
||||
DECL_LINK(ExpandingHandlerServices, const weld::TreeIter&, bool);
|
||||
DECL_LINK(ExpandingHandlerProperties, const weld::TreeIter&, bool);
|
||||
DECL_LINK(ExpandingHandlerMethods, const weld::TreeIter&, bool);
|
||||
|
||||
// callback when the tree view selection changed to a different node
|
||||
DECL_LINK(SelectionChanged, weld::TreeView&, void);
|
||||
|
||||
// callback when a pop-up is triggered on a tree view node
|
||||
DECL_LINK(PopupMenuHandler, const CommandEvent&, bool);
|
||||
|
||||
// callback when a button is clicked on a toolbar
|
||||
DECL_LINK(ToolbarButtonClicked, const OString&, void);
|
||||
|
||||
// callback when a page is entered or left on the notebook bar for
|
||||
// different categories
|
||||
DECL_LINK(NotebookEnterPage, const OString&, void);
|
||||
DECL_LINK(NotebookLeavePage, const OString&, bool);
|
||||
|
||||
|
@ -60,26 +60,6 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi
|
||||
maObjectInspectorTreeHandler.introspect(mxRoot);
|
||||
}
|
||||
|
||||
void DevelopmentToolDockingWindow::inspectSelectionOrRoot()
|
||||
{
|
||||
if (mxSelectionSupplier.is())
|
||||
{
|
||||
css::uno::Any aAny = mxSelectionSupplier->getSelection();
|
||||
if (aAny.hasValue())
|
||||
{
|
||||
auto xInterface = aAny.get<css::uno::Reference<css::uno::XInterface>>();
|
||||
if (xInterface.is())
|
||||
{
|
||||
maObjectInspectorTreeHandler.introspect(xInterface);
|
||||
mpSelectionToggle->set_state(TRISTATE_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
mpSelectionToggle->set_state(TRISTATE_FALSE);
|
||||
maObjectInspectorTreeHandler.introspect(mxRoot);
|
||||
}
|
||||
|
||||
IMPL_LINK(DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler, weld::TreeView&,
|
||||
rView, void)
|
||||
{
|
||||
@ -155,6 +135,24 @@ void DevelopmentToolDockingWindow::selectionChanged(
|
||||
updateSelection();
|
||||
}
|
||||
|
||||
void DevelopmentToolDockingWindow::changeToCurrentSelection() { inspectSelectionOrRoot(); }
|
||||
void DevelopmentToolDockingWindow::changeToCurrentSelection()
|
||||
{
|
||||
if (mxSelectionSupplier.is())
|
||||
{
|
||||
css::uno::Any aAny = mxSelectionSupplier->getSelection();
|
||||
if (aAny.hasValue())
|
||||
{
|
||||
auto xInterface = aAny.get<css::uno::Reference<css::uno::XInterface>>();
|
||||
if (xInterface.is())
|
||||
{
|
||||
maObjectInspectorTreeHandler.introspect(xInterface);
|
||||
mpSelectionToggle->set_state(TRISTATE_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
mpSelectionToggle->set_state(TRISTATE_FALSE);
|
||||
maObjectInspectorTreeHandler.introspect(mxRoot);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -57,6 +57,7 @@ OUString lclAppend(std::unique_ptr<weld::TreeView>& rTree, OUString const& rStri
|
||||
return sId;
|
||||
}
|
||||
|
||||
// returns a name of the object, if available
|
||||
OUString lclGetNamed(uno::Reference<uno::XInterface> const& xObject)
|
||||
{
|
||||
uno::Reference<container::XNamed> xNamed(xObject, uno::UNO_QUERY);
|
||||
@ -65,11 +66,11 @@ OUString lclGetNamed(uno::Reference<uno::XInterface> const& xObject)
|
||||
return xNamed->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* DocumentModelTreeEntry represents an object that is "attached" to
|
||||
* the tree view an is responsible to provide the UNO object associated
|
||||
* with the current node and on demand create and fill the children of
|
||||
* the said node.
|
||||
/** DocumentModelTreeEntry is an object "attached" to a tree node.
|
||||
*
|
||||
* It represents an object that is "attached" to the tree view an is
|
||||
* responsible to provide the UNO object associated with the current
|
||||
* node and on demand create and fill the children of the said node.
|
||||
*/
|
||||
class DocumentModelTreeEntry
|
||||
{
|
||||
@ -113,6 +114,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
/** Entry that represents the document root object */
|
||||
class DocumentRootEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -122,6 +124,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a paragraph object (XParagraph) */
|
||||
class ParagraphEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -156,6 +159,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of paragraphs */
|
||||
class ParagraphsEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -200,6 +204,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of shapes */
|
||||
class ShapesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -236,6 +241,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of tables */
|
||||
class TablesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -259,6 +265,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of frames */
|
||||
class FramesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -282,6 +289,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of writer graphic objects */
|
||||
class WriterGraphicObjectsEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -305,6 +313,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of writer embedded (OLE) objects */
|
||||
class EmbeddedObjectsEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -328,6 +337,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a style family, whcih contains a list of styles */
|
||||
class StylesFamilyEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -343,6 +353,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of style families */
|
||||
class StylesFamiliesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -379,6 +390,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of pages */
|
||||
class PagesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -416,6 +428,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of (Impress) slides */
|
||||
class SlidesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -453,6 +466,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of (Impress) master slides */
|
||||
class MasterSlidesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -490,6 +504,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of charts */
|
||||
class ChartsEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -516,6 +531,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of pivot tables */
|
||||
class PivotTablesEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -542,6 +558,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a (Calc) sheet */
|
||||
class SheetEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -565,6 +582,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Represents a list of (Calc) sheet */
|
||||
class SheetsEntry : public DocumentModelTreeEntry
|
||||
{
|
||||
public:
|
||||
@ -685,37 +703,37 @@ void DocumentModelTreeHandler::inspectDocument()
|
||||
{
|
||||
uno::Reference<lang::XServiceInfo> xDocumentServiceInfo(mxDocument, uno::UNO_QUERY_THROW);
|
||||
|
||||
lclAppend(mpDocumentModelTree, "Document", new DocumentRootEntry(mxDocument), false);
|
||||
lclAppend(mpDocumentModelTree, u"Document", new DocumentRootEntry(mxDocument), false);
|
||||
|
||||
if (xDocumentServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
|
||||
{
|
||||
lclAppend(mpDocumentModelTree, "Sheets", new SheetsEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Sheets", new SheetsEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
}
|
||||
else if (xDocumentServiceInfo->supportsService(
|
||||
"com.sun.star.presentation.PresentationDocument"))
|
||||
{
|
||||
lclAppend(mpDocumentModelTree, "Slides", new SlidesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Master Slides", new MasterSlidesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Slides", new SlidesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Master Slides", new MasterSlidesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
}
|
||||
else if (xDocumentServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument"))
|
||||
{
|
||||
lclAppend(mpDocumentModelTree, "Pages", new PagesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Pages", new PagesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
}
|
||||
else if (xDocumentServiceInfo->supportsService("com.sun.star.text.TextDocument")
|
||||
|| xDocumentServiceInfo->supportsService("com.sun.star.text.WebDocument"))
|
||||
{
|
||||
lclAppend(mpDocumentModelTree, "Paragraphs", new ParagraphsEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Shapes", new ShapesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Tables", new TablesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Frames", new FramesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, "Graphic Objects", new WriterGraphicObjectsEntry(mxDocument),
|
||||
lclAppend(mpDocumentModelTree, u"Paragraphs", new ParagraphsEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Shapes", new ShapesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Tables", new TablesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Frames", new FramesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Graphic Objects",
|
||||
new WriterGraphicObjectsEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Embedded Objects", new EmbeddedObjectsEntry(mxDocument),
|
||||
true);
|
||||
lclAppend(mpDocumentModelTree, "Embedded Objects", new EmbeddedObjectsEntry(mxDocument),
|
||||
true);
|
||||
lclAppend(mpDocumentModelTree, "Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
lclAppend(mpDocumentModelTree, u"Styles", new StylesFamiliesEntry(mxDocument), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ namespace
|
||||
constexpr OUStringLiteral constTypeDescriptionManagerSingletonName
|
||||
= u"/singletons/com.sun.star.reflection.theTypeDescriptionManager";
|
||||
|
||||
/** converts any value to a string */
|
||||
OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& xContext)
|
||||
{
|
||||
OUString aRetStr;
|
||||
@ -181,12 +182,14 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen
|
||||
return aRetStr;
|
||||
}
|
||||
|
||||
/** converts an any's type to a string (in a short form) */
|
||||
OUString getAnyType(const uno::Any& aValue)
|
||||
{
|
||||
OUString aTypeName = aValue.getValueType().getTypeName();
|
||||
return aTypeName.replaceAll("com.sun.star", "css");
|
||||
}
|
||||
|
||||
/** converts a Type to a XIdlClass */
|
||||
uno::Reference<reflection::XIdlClass>
|
||||
convertTypeToIdlClass(const uno::Type& rType,
|
||||
const uno::Reference<uno::XComponentContext>& xContext)
|
||||
@ -197,6 +200,15 @@ convertTypeToIdlClass(const uno::Type& rType,
|
||||
|
||||
// Object inspector nodes
|
||||
|
||||
/** Object inspector node's main interface
|
||||
*
|
||||
* The interface for the "attached" object to a tree view nodes that
|
||||
* are added to the tree views of the object inspector part. The node
|
||||
* can return the main value of the node (object name) and if present
|
||||
* also the values for additional columns. It signals if a tree needs
|
||||
* an expander and fills the children of the tree is any exists.
|
||||
*
|
||||
*/
|
||||
class ObjectInspectorNodeInterface
|
||||
{
|
||||
public:
|
||||
@ -204,19 +216,24 @@ public:
|
||||
|
||||
virtual ~ObjectInspectorNodeInterface() {}
|
||||
|
||||
// main value (object name) of the tree view node
|
||||
virtual OUString getObjectName() = 0;
|
||||
|
||||
// should show the expander for the tree view node
|
||||
virtual bool shouldShowExpander() { return false; }
|
||||
|
||||
// fill the children for the current tree view node
|
||||
virtual void fillChildren(std::unique_ptr<weld::TreeView>& rTree, const weld::TreeIter* pParent)
|
||||
= 0;
|
||||
|
||||
// fill any additional column values for the current tree view node
|
||||
virtual std::vector<std::pair<sal_Int32, OUString>> getColumnValues()
|
||||
{
|
||||
return std::vector<std::pair<sal_Int32, OUString>>();
|
||||
}
|
||||
};
|
||||
|
||||
// appends the node to the root of the tree view
|
||||
OUString lclAppendNode(std::unique_ptr<weld::TreeView>& pTree, ObjectInspectorNodeInterface* pEntry)
|
||||
{
|
||||
OUString sName = pEntry->getObjectName();
|
||||
@ -234,6 +251,7 @@ OUString lclAppendNode(std::unique_ptr<weld::TreeView>& pTree, ObjectInspectorNo
|
||||
return sId;
|
||||
}
|
||||
|
||||
// appends the node to the parent
|
||||
OUString lclAppendNodeToParent(std::unique_ptr<weld::TreeView>& pTree,
|
||||
const weld::TreeIter* pParent, ObjectInspectorNodeInterface* pEntry)
|
||||
{
|
||||
@ -252,6 +270,7 @@ OUString lclAppendNodeToParent(std::unique_ptr<weld::TreeView>& pTree,
|
||||
return sId;
|
||||
}
|
||||
|
||||
/** Node that represent just a simple string with no children or columns */
|
||||
class SimpleStringNode : public ObjectInspectorNodeInterface
|
||||
{
|
||||
protected:
|
||||
@ -271,6 +290,7 @@ public:
|
||||
OUString getObjectName() override { return msName; }
|
||||
};
|
||||
|
||||
/** Node represents a method of an object */
|
||||
class MethodNode : public ObjectInspectorNodeInterface
|
||||
{
|
||||
private:
|
||||
@ -351,6 +371,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Node represents a class (XIdlClass) of an object.
|
||||
*
|
||||
* Children are superclasses of the current class. XInterface superclass
|
||||
* is ignored.
|
||||
*
|
||||
*/
|
||||
class ClassNode : public ObjectInspectorNodeInterface
|
||||
{
|
||||
private:
|
||||
@ -376,6 +402,7 @@ public:
|
||||
|
||||
OUString getObjectName() override { return mxClass->getName(); }
|
||||
|
||||
// Fill superclasses
|
||||
void fillChildren(std::unique_ptr<weld::TreeView>& rTree,
|
||||
const weld::TreeIter* pParent) override
|
||||
{
|
||||
@ -388,6 +415,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Node represents a basic value, that can be any object, sequece, struct */
|
||||
class BasicValueNode : public SimpleStringNode
|
||||
{
|
||||
protected:
|
||||
@ -439,6 +467,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/** Node represents a property */
|
||||
class GenericPropertiesNode : public BasicValueNode
|
||||
{
|
||||
public:
|
||||
@ -452,6 +481,7 @@ public:
|
||||
const weld::TreeIter* pParent) override;
|
||||
};
|
||||
|
||||
/** Node represents a struct */
|
||||
class StructNode : public BasicValueNode
|
||||
{
|
||||
public:
|
||||
@ -467,6 +497,7 @@ public:
|
||||
const weld::TreeIter* pParent) override;
|
||||
};
|
||||
|
||||
/** Node represents a sequence */
|
||||
class SequenceNode : public BasicValueNode
|
||||
{
|
||||
uno::Reference<reflection::XIdlArray> mxIdlArray;
|
||||
@ -710,8 +741,11 @@ BasicValueNode::createNodeObjectForAny(OUString const& rName, uno::Any& rAny, OU
|
||||
return new BasicValueNode(rName, rAny, rInfo, mxContext);
|
||||
}
|
||||
|
||||
// helper functions
|
||||
} // end anonymous namespace
|
||||
|
||||
// Object inspector tree view helper functions
|
||||
namespace
|
||||
{
|
||||
ObjectInspectorNodeInterface* getSelectedNode(weld::TreeView const& rTreeView)
|
||||
{
|
||||
OUString sID = rTreeView.get_selected_id();
|
||||
@ -990,6 +1024,7 @@ void ObjectInspectorTreeHandler::clearObjectInspectorChildren(
|
||||
} while (bChild);
|
||||
}
|
||||
|
||||
/** Deletes all the node objects in a tree view */
|
||||
void ObjectInspectorTreeHandler::clearAll(std::unique_ptr<weld::TreeView>& pTreeView)
|
||||
{
|
||||
// destroy all ObjectInspectorNodes from the tree
|
||||
@ -1002,6 +1037,7 @@ void ObjectInspectorTreeHandler::clearAll(std::unique_ptr<weld::TreeView>& pTree
|
||||
pTreeView->clear();
|
||||
}
|
||||
|
||||
/** Append interfaces to the "interfaces" tree view */
|
||||
void ObjectInspectorTreeHandler::appendInterfaces(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
if (!xInterface.is())
|
||||
@ -1019,6 +1055,7 @@ void ObjectInspectorTreeHandler::appendInterfaces(uno::Reference<uno::XInterface
|
||||
}
|
||||
}
|
||||
|
||||
/** Append services to the "services" tree view */
|
||||
void ObjectInspectorTreeHandler::appendServices(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
if (!xInterface.is())
|
||||
@ -1032,6 +1069,7 @@ void ObjectInspectorTreeHandler::appendServices(uno::Reference<uno::XInterface>
|
||||
}
|
||||
}
|
||||
|
||||
/** Append properties to the "properties" tree view */
|
||||
void ObjectInspectorTreeHandler::appendProperties(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
if (!xInterface.is())
|
||||
@ -1040,6 +1078,7 @@ void ObjectInspectorTreeHandler::appendProperties(uno::Reference<uno::XInterface
|
||||
aNode.fillChildren(mpPropertiesTreeView, nullptr);
|
||||
}
|
||||
|
||||
/** Append methods to the "methods" tree view */
|
||||
void ObjectInspectorTreeHandler::appendMethods(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
if (!xInterface.is())
|
||||
@ -1060,18 +1099,21 @@ void ObjectInspectorTreeHandler::updateBackButtonState()
|
||||
mpObjectInspectorToolbar->set_item_sensitive("back", maInspectionStack.size() > 1);
|
||||
}
|
||||
|
||||
// Clears all the objects from the stack
|
||||
void ObjectInspectorTreeHandler::clearStack()
|
||||
{
|
||||
maInspectionStack.clear();
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
// Adds an object to the stack
|
||||
void ObjectInspectorTreeHandler::addToStack(css::uno::Any const& rAny)
|
||||
{
|
||||
maInspectionStack.push_back(rAny);
|
||||
updateBackButtonState();
|
||||
}
|
||||
|
||||
// Removes an object from the back of the stack and return it
|
||||
css::uno::Any ObjectInspectorTreeHandler::popFromStack()
|
||||
{
|
||||
maInspectionStack.pop_back();
|
||||
@ -1080,6 +1122,7 @@ css::uno::Any ObjectInspectorTreeHandler::popFromStack()
|
||||
return aAny;
|
||||
}
|
||||
|
||||
// Inspect the input object in the object inspector
|
||||
void ObjectInspectorTreeHandler::inspectObject(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
if (!xInterface.is())
|
||||
@ -1090,10 +1133,14 @@ void ObjectInspectorTreeHandler::inspectObject(uno::Reference<uno::XInterface> c
|
||||
OUString aImplementationName = xServiceInfo->getImplementationName();
|
||||
mpClassNameLabel->set_label(aImplementationName);
|
||||
|
||||
// Fire entering the current opened page manually
|
||||
auto rPageId = mpObjectInspectorNotebook->get_current_page_ident();
|
||||
NotebookEnterPage(rPageId);
|
||||
}
|
||||
|
||||
// Inspect the input object in the object inspector.
|
||||
// Make the input object the root of the stack (clear all other
|
||||
// objects from the stack).
|
||||
void ObjectInspectorTreeHandler::introspect(uno::Reference<uno::XInterface> const& xInterface)
|
||||
{
|
||||
clearStack();
|
||||
@ -1103,6 +1150,7 @@ void ObjectInspectorTreeHandler::introspect(uno::Reference<uno::XInterface> cons
|
||||
|
||||
void ObjectInspectorTreeHandler::dispose()
|
||||
{
|
||||
// We need to clear all the nodes
|
||||
clearAll(mpInterfacesTreeView);
|
||||
clearAll(mpServicesTreeView);
|
||||
clearAll(mpPropertiesTreeView);
|
||||
|
@ -23,6 +23,11 @@
|
||||
typedef cppu::WeakComponentImplHelper<css::view::XSelectionChangeListener>
|
||||
SelectionChangeHandlerInterfaceBase;
|
||||
|
||||
/** Selection change handler to listen to document selection changes.
|
||||
*
|
||||
* Listens to the changes and notifies the docking window with a new
|
||||
* selected object, when a change happens.
|
||||
*/
|
||||
class SelectionChangeHandler final : private ::cppu::BaseMutex,
|
||||
public SelectionChangeHandlerInterfaceBase
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user