Application class being abstract is not the essence of factory pattern, but we need to see the intent behind it. The same intent is being fulfilled by abstract Plugin class ( in below example implementation).
Any class deferring the object creation to its sub class for the object it needs to work with can be seen as an example of Factory pattern.
Factory pattern as described in GOF presents an example of possible implementation of document application for understanding but not specific to specific Word application but still we can have a possible below factory method
based design
For current Word application a possible design can be similar to plugin based where we can have multiple plugins and each can be added to the application. The entity(in this case Document) creation is done by the each plugin.
If a new type of document is needed then a plugin can be implemented and added to the application.
A possible structure of the code can be like below.
Class Application{
List<Plugin> plugins ;
public void addPlugin(Plugin newPlugin){
plugins.add(newPlugin);
}
//more code as per req and features
}
public abstract class Plugin{
public abstract Document createNewDocument();
public void openNewDocument(){
Document doc = createNewDocument();
doc.open();// assuming open is a method in Document interface.
//more code as per req and features
}
}
public class PNGPlugin extends Plugin{
public Document createNewDocument(){
return new PNGDocument();// Document being the interface for various documents.
}
//more code as per req and features
}
Menu items will in current approach depend upon the list of plugins.